-
May 30th, 2002, 09:51 PM
#1
Joining a string which is split by Carriage return Line Feed
Hello,
I'm stuck in a situation now..I hope someone out there can help get me out of it...here's the situation:
I now have a string as follows:
abcstring =
ABCDEFG
HIJKLMNO
PQRSTUV
WXYZ
how am I able to join all the strings to form a string
ABCDEFGHIJKLMNOPQRSTUVWXYZ
i.e. delete off the carriage return line feed
Thanks in advance!
Joe
-
May 30th, 2002, 10:03 PM
#2
Make sure you have a reference to the Vb Scripting dll. (Microsoft Scripting Runtime - sccrun.dll)
Then, use
abcstring = replace(abcstring,chr(10),"")
abcstring = replace(abcstring,chr(13),"")
msgbox abcstring
-
May 30th, 2002, 10:10 PM
#3
Err..so sorry, mate,
but how do I reference to the DLL?
I've thought of another "primitive" method,
what I did was, I split the string based of vbcrlf,
i.e. Lines = Split(abcstring, vbCrLf)
then I used a for loop to join them...
the arrays of strings (Lines) up.
Joseph
-
May 30th, 2002, 10:39 PM
#4
Project->References
Then select the dll I posted earlier
NOTE - If you're using SourceSafe, you must check out your project file first.
-
May 30th, 2002, 11:18 PM
#5
Code:
Private Sub Command1_Click()
Dim Lines As Variant
Lines = Split(abcstring, vbCrLf)
MsgBox Join(Lines, "")
End Sub
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
|