Here is the string (oCoord As String) I'm working on:
Now, I want to modify it so that all characters highlighted in red are removed like this:
The problem is when I'm looping through the string, the statement Mid(oCoord, i, 1) = "" {no space between the quotes} doesn't work at all while adding a single space between the quotes returns double spaces instead of removing the unneeded character. I tried Mid(oCoord, i, 1) = Replace(oCoord, Mid(oCoord, i, 1), "") but as a result I get ALL spaces removed.
PS: TRIM() function didn't help either!
Can I get your assistance in this matter? Thank you very much in advance!!!
Rustam
Code:
[COLOR=#ff0000]N[/COLOR]37[COLOR=#ff0000]°[/COLOR] 8[COLOR=#ff0000]'[/COLOR] 30.52[COLOR=#ff0000]"[/COLOR],[COLOR=#ff0000]W[/COLOR]107[COLOR=#ff0000]°[/COLOR] 45[COLOR=#ff0000]'[/COLOR] 46.92[COLOR=#ff0000]"[/COLOR],[COLOR=#ff0000]+[/COLOR]006682.00
Now, I want to modify it so that all characters highlighted in red are removed like this:
Code:
37 8 30.52,107 45 46.92,006682.00
The problem is when I'm looping through the string, the statement Mid(oCoord, i, 1) = "" {no space between the quotes} doesn't work at all while adding a single space between the quotes returns double spaces instead of removing the unneeded character. I tried Mid(oCoord, i, 1) = Replace(oCoord, Mid(oCoord, i, 1), "") but as a result I get ALL spaces removed.
PS: TRIM() function didn't help either!
Code:
For i = 1 To Len(oCoord)
sChar = Mid(oCoord, i, 1)
Select Case True
Case sChar = Chr(176) ' degree sign " ° "
Mid(oCoord, i, 1) = " "
Case sChar = Chr(39) ' single quote sign " ' "
Mid(oCoord, i, 1) = " "
Case sChar = Chr(34) ' double quotes " "
Mid(oCoord, i, 1) = " "
Case sChar = Chr(43) ' plus sign " + "
Mid(oCoord, i, 1) = " "
Case sChar = "N"
Mid(oCoord, i, 1) = " "
Case sChar = "E"
Mid(oCoord, i, 1) = " "
Case sChar = "S"
Mid(oCoord, i, 1) = "-"
Case sChar = "W"
Mid(oCoord, i, 1) = "-"
Case Else
End Select
Next
Can I get your assistance in this matter? Thank you very much in advance!!!
Rustam