Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Need to rearrange order of a string...

Bad EggBad Egg Member Posts: 1
Hi, I hope someone that knows VB can help me. I only use very simple VB expressions for GIS (ArcMap 9.2) to make labels or populate fields in attribute tables.

I need to change the order of a number with VB and leave out dashes and populate another field with it.

Example:
The number that I already have in my data looks like this:
12-28-4977BG

^^^This number is called [WELLNUM]

I need to populate another field with a rearranged version of that number, so it looks like this:

49772812BG

^^^This number is called [F_ID]

***These numbers just represent township, range, section, and place numbers.

Any help would be most appreciated.

Comments

  • dokken2dokken2 Member Posts: 532
    quite easy to parse with the MID string function which returns a string based on a start position and the length/number of characters

    [code]
    Dim WELLNUM As String
    Dim F_ID As String

    WELLNUM = "12-28-4977BG"

    F_ID = Mid(WELLNUM, 7, 4) & _
    Mid(WELLNUM, 4, 2) & _
    Mid(WELLNUM, 1, 2) & _
    Mid(WELLNUM, 11, 2)

    MsgBox WELLNUM & vbCr & F_ID
    [/code]
Sign In or Register to comment.