Click to See Complete Forum and Search --> : Strings


programming fool
July 1st, 2001, 03:50 PM
How do you search a string for the vbCrLf
character and then separate the string into
two strings without the vbCrLf character?

deghost
July 1st, 2001, 04:13 PM
try this code:

Dim tmp as string
Dim s1 as string, s2 as string

tmp = "First string" & vbCrLf & "Second string"
s1 = mid$(tmp, 1, InStr(1, tmp, vbCrLf) - 1)
s2 = mid$(tmp, InStr(1, tmp, vbCrLf) + 2,
len(tmp)) 'vbCrLf is 2 chars, that's why + 2




----------
The @host is everywhere!
----------

d.paulson
July 1st, 2001, 04:45 PM
Try using the split function.

Modify to suit your needs


Dim tmp As String
Dim s1() As String
tmp = "First string" & vbCrLf & "Second string"
s1 = Split(tmp, vbCrLf)
Text1 = s1(0)
Text2 = s1(1)



David Paulson