|
-
Feb 15th, 2001, 12:58 PM
#1
Thread Starter
Lively Member
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
Why can't every day be Saturday ??
-
Feb 15th, 2001, 01:08 PM
#2
transcendental analytic
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
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 15th, 2001, 01:21 PM
#3
Thread Starter
Lively Member
thanks mate I will give it a try !!
Why can't every day be Saturday ??
-
Feb 15th, 2001, 02:02 PM
#4
Thread Starter
Lively Member
Thanks Kedaman it worked perfectly
Murtagh
Why can't every day be Saturday ??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|