def getEndIndex(string):
    """Returns the index of the space after the value before its units

    >>> string = '   R2 = 1 173 Ohm\\n'
    >>> getEndIndex(string)
    13
    """
    lastIndex = len(string) - 1
    while string[lastIndex] != ' ':
        lastIndex -= 1
    return lastIndex