|
-
July 2nd, 2001, 08:32 AM
#1
Strings
What represents a new line in a String? I thought it would be line feed, but it isn't...
So, what is it?
-
July 2nd, 2001, 08:42 AM
#2
Re: Strings
chr$(13) & chr$(10)
or
vbCrlf
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
July 3rd, 2001, 09:32 AM
#3
Re: Strings
When I try using the InStr function to look for those characters in a string it does not find them!
-
July 3rd, 2001, 10:04 AM
#4
Re: Strings
here is a quick sample using VBcr, vblf and vbcrlf
option Explicit
private Sub Command1_Click()
Dim str, X
'str = "The quick Brown Fox" & vbCrLf & "Jumps over the lazy dog"
' either way will work
str = "The quick Brown Fox" & vbCr & vbLf & "Jumps over the lazy dog"
X = InStr(str, vbCrLf)
MsgBox X
End Sub
John G
-
July 4th, 2001, 02:16 AM
#5
Re: Strings
option Explicit
private Sub Command1_Click()
Dim strString as string
strString = "blablabla" & Chr$(13) & Chr$(10) & "blablablabla"
MsgBox fnctFindIt(strString) 'will be 10
strString = "blablablablab" & vbCrLf & "blablablabla"
MsgBox fnctFindIt(strString) 'will be 14
End Sub
private Function fnctFindIt(byval strParm as string) as string
Dim intFoundPos as Integer
intFoundPos = InStr(1, strParm, Chr$(13) & Chr$(10), vbBinaryCompare)
If intFoundPos > 0 then
fnctFindIt = "Line feed and carriage return found starting at " & intFoundPos & " position"
else
fnctFindIt = "Line feed and carriage return NOT found"
End If
End Function
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
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
|