programming fool
July 2nd, 2001, 08:32 AM
What represents a new line in a String? I thought it would be line feed, but it isn't...
So, what is it?
So, what is it?
|
Click to See Complete Forum and Search --> : Strings programming fool July 2nd, 2001, 08:32 AM What represents a new line in a String? I thought it would be line feed, but it isn't... So, what is it? Cimperiali July 2nd, 2001, 08:42 AM 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. programming fool July 3rd, 2001, 09:32 AM When I try using the InStr function to look for those characters in a string it does not find them! John G Duffy July 3rd, 2001, 10:04 AM 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 Cimperiali July 4th, 2001, 02:16 AM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |