Skip to main content
added 2 characters in body
Source Link
Aaron
  • 52k
  • 30
  • 161
  • 327

Here is a simple approach using the built-in Python .isdigit(), .isalpha() and .zfill() methods. This approach uses the Python parser.


Pre-logic code blockScript Code:

def changeAddress(y):
  integer = ''.join(x for x in y if x.isdigit())
  string = ''.join(x for x in y if x.isalpha())
  final = integer.zfill(3)
  return final + string

changeAddress(!YourField!)

enter image description here

Here is a simple approach using the built-in Python .isdigit(), .isalpha() and .zfill() methods. This approach uses the Python parser.


Pre-logic code block

def changeAddress(y):
  integer = ''.join(x for x in y if x.isdigit())
  string = ''.join(x for x in y if x.isalpha())
  final = integer.zfill(3)
  return final + string

changeAddress(!YourField!)

Here is a simple approach using the built-in Python .isdigit(), .isalpha() and .zfill() methods. This approach uses the Python parser.


Pre-logic Script Code:

def changeAddress(y):
  integer = ''.join(x for x in y if x.isdigit())
  string = ''.join(x for x in y if x.isalpha())
  final = integer.zfill(3)
  return final + string

changeAddress(!YourField!)

enter image description here

Source Link
Aaron
  • 52k
  • 30
  • 161
  • 327

Here is a simple approach using the built-in Python .isdigit(), .isalpha() and .zfill() methods. This approach uses the Python parser.


Pre-logic code block

def changeAddress(y):
  integer = ''.join(x for x in y if x.isdigit())
  string = ''.join(x for x in y if x.isalpha())
  final = integer.zfill(3)
  return final + string

changeAddress(!YourField!)