I am trying to use field calculator to move numbers to the front of a value. For example, Apple Dr. 245 to 245 Apple Dr. I have tried a bunch of different python scripts that are AI generated but I can't get it to work. Does anyone know why I could be having issues with this? Here is one script I tried for example:
def move_numbers_to_front(value):
words = value.split()
if len(words) > 1 and words[-1].isnumeric():
return f"{words[-1]} {' '.join(words[:-1])}"
return value
# Usage: move_numbers_to_front(!CableName!)