Hey,
I have a string, and I want to get the value of the first and second lines to 2 strings.
Thanks!
Printable View
Hey,
I have a string, and I want to get the value of the first and second lines to 2 strings.
Thanks!
Can you be more specific I dont understand what ur saying...
like i have a string with 2 lines
i want to get the value of the first and second line into to different strings
First get the index of the line break. (vbCrLf)
VB Code:
Dim intIndex As Integer = myString.IndexOf(vbCrLf)
Then get the substrings
VB Code:
Dim line1 As String = myString.Substring(0, intIndex) Dim line2 As String = myString.SubString(intIndex + 1, (myString.Length - 1) - intIndex)
This code is untested so the index's, lengths may be a little off, but basically it's just a case of using a combination of index and substring methods.