aaronk Well-Known Member Licensed User Longtime User Dec 2, 2012 #1 Hello, I am using the following code: Code: Copy Dim msg As String msg = "123" & CRLF & "456" & CRLF & "789" Dim strBeforeSplit As String strBeforeSplit=msg Dim strSplit() As String strSplit=Regex.Split(CRLF,strBeforeSplit) what the code above does is runs through the msg string and splits the string based on a CRLF so, if I log strSplit(0) it would log 123 if I log strSplit(1) it would log 456 etc. but I need to find out how many CRLF / strSplit(x) there are. does anyone have any ideas ?
Hello, I am using the following code: Code: Copy Dim msg As String msg = "123" & CRLF & "456" & CRLF & "789" Dim strBeforeSplit As String strBeforeSplit=msg Dim strSplit() As String strSplit=Regex.Split(CRLF,strBeforeSplit) what the code above does is runs through the msg string and splits the string based on a CRLF so, if I log strSplit(0) it would log 123 if I log strSplit(1) it would log 456 etc. but I need to find out how many CRLF / strSplit(x) there are. does anyone have any ideas ?
NJDude Expert Licensed User Longtime User Dec 2, 2012 #2 The number of CRLF will be: Number of splits - 1 Upvote 0
margret Well-Known Member Licensed User Longtime User Dec 2, 2012 #3 It should be strSplit.Length -1 Upvote 0
aaronk Well-Known Member Licensed User Longtime User Dec 2, 2012 #4 Hello, Thanks for the fast reply.. I ended up getting it working by doing this: (which is basically what you guys are saying) Code: Copy Dim msg As String msg = "123" & CRLF & "456" & CRLF & "789" Dim strBeforeSplit As String strBeforeSplit=msg Dim strSplit() As String strSplit=Regex.Split(CRLF,strBeforeSplit) For x = 0 To strSplit.Length - 1 Log(strSplit(x)) Next Upvote 0
Hello, Thanks for the fast reply.. I ended up getting it working by doing this: (which is basically what you guys are saying) Code: Copy Dim msg As String msg = "123" & CRLF & "456" & CRLF & "789" Dim strBeforeSplit As String strBeforeSplit=msg Dim strSplit() As String strSplit=Regex.Split(CRLF,strBeforeSplit) For x = 0 To strSplit.Length - 1 Log(strSplit(x)) Next