-
I am having a problem, I have a sting and i want to remove the extra spaces from the line so that there is only one space bar key press between each word. ie
strAns = E 3 10:53 1:z1100 77 sqfp80 180 -6 -9 1800 1 qp242a-17 Missing
I would like this to be;
strAns = E 3 10:53 1:z1100 77 sqfp80 180 -6 -9 1800 1 qp242a-17 Missing
Any help is appreciated, I have tryed the replace function but cannot get the syntax right
-
How about using my function nodoublespaces:
Code:
Function nodoublespaces(str As String)
Dim a() As Byte, s&, n&, v As Boolean
a = StrConv(str, vbFromUnicode)
For n = 0 To UBound(a)
If a(n) = 32 And v Then s = s - 1
If s <> n Then a(s) = a(n)
v = a(s) = 32
s = s + 1
Next n
ReDim Preserve a(s)
nodoublespaces = StrConv(a, vbUnicode)
End Function
-
thanks mate I will give it a try !!
-
Thanks Kedaman it worked perfectly
Murtagh