Calculate Station from Decimal

Here's a little python function to calculate the stationing text from a decimal number

def calculate(value):
    valDecimal =  value.split('.')[1][:2]
    if len(valDecimal) == 1:
        valDecimal = valDecimal + "0"
    varLast = value.split('.')[0][-2:]
    varFirst = value.split('.')[0][:-2]
    return varFirst + "+" + varLast + "." + valDecimal

calculate( str(!BEGIN_STATION!) )

Input - 5622.068
Output - 56+22.06

Popular posts from this blog

How to Transfer Domains to a New Database