Function retrives info between 2 delimiters, or the whole string.
Function retrives info between 2 delimiters, or the whole string.
Rate Function retrives info between 2 delimiters, or the whole string.
(1(1 Vote))
Private Function ParseString(strRecieved As String, strDelimiter As String, intStart As Integer, _
intStop As Integer) As String
'parse the string, get the info between 2 delimiters
'use '0' to start at the beginning of the string, (not the 1st delimiter)
'use the last delimiter number +1 to get the end of the string
Dim x As Integer
Dim DelimiterLocArray() As String
Dim intCounter As Integer
ReDim DelimiterLocArray(0)
DelimiterLocArray(0) = "0"
For x = 1 To Len(strRecieved)
If Mid$(strRecieved, x, 1) = strDelimiter Then
intCounter = intCounter + 1
ReDim Preserve DelimiterLocArray(intCounter)
DelimiterLocArray(intCounter) = x
End If
Next x
ReDim Preserve DelimiterLocArray(UBound(DelimiterLocArray) + 1)
DelimiterLocArray(UBound(DelimiterLocArray)) = Len(strRecieved) + 1
ParseString = Mid$(strRecieved, CInt(DelimiterLocArray(intStart)) + 1, CInt(DelimiterLocArray(intStop) _
- 1 - CInt(DelimiterLocArray(intStart))))
Erase DelimiterLocArray
End Function
strResult = ParseString("this is the time", " ", 0, 1)
strResult = ParseString("this is the time", " ", 3, 4)
Function retrives info between 2 delimiters, or the whole string. Comments
No comments yet — be the first to post one!
Post a Comment