Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i have this var=AG. 3CATANIA or AG. 15PALERMO

    i want to insert space afeer the number 3 or after 15
    but you know:
    the numeric index after AG. can be max 2 character for example AG. 11, AG. 25, AG. 99... ecc.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You can use code like this:

    Code:
    Dim myvar As String
    Dim i As Integer
    myvar = "AG. 15PALERMO"
    ' Move past the first space
    i = InStr(myvar, " ") + 1
    ' Move to the right as long as character is numeric
    Do While IsNumeric(Mid(myvar, i, 1))
      i = i + 1
    Loop
    ' We're now past the numeric part; insert a space
    myvar = Left(myvar, i - 1) & " " & Mid(myvar, i)

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='771002' date='17-Apr-2009 12:40']You can use code like this:

    Code:
    Dim myvar As String
    Dim i As Integer
    myvar = "AG. 15PALERMO"
    ' Move past the first space
    i = InStr(myvar, " ") + 1
    ' Move to the right as long as character is numeric
    Do While IsNumeric(Mid(myvar, i, 1))
      i = i + 1
    Loop
    ' We're now past the numeric part; insert a space
    myvar = Left(myvar, i - 1) & " " & Mid(myvar, i)
    [/quote]

    EXCELLENT!
    tKS!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •