- Home
·
- String Manipulation
·
- These two functions are usefull for reading .ini files. GetBefore returns everything in the string
These two functions are usefull for reading .ini files. GetBefore returns everything in the string
These two functions are usefull for reading .ini files. GetBefore returns everything in the string before the "=" sign. GetAfter, returns all
Rate These two functions are usefull for reading .ini files. GetBefore returns everything in the string
(1(1 Vote))
'string before the "=" sign.
Const Sign = "="
Dim Counter As Integer
Dim Before As String
'find the position of the equals sign
Counter = 1
For Counter = 1 To Len(Sentence)
If Mid(Sentence, Counter, 1) = Sign Then
'break loop on first equals sign.
Exit For
End If
Next Counter
If Counter <> Len(Sentence) Then
Before = Left(Sentence, (Counter - 1))
Else
Before = ""
End If
GetBefore = Before
End Function
Public Function GetAfter(Sentence As String) As String
'string after the "=" sign.
Const Sign = "="
Dim Counter As Integer
Dim Rest As String
'find the position of the equals sign
Counter = 1
For Counter = 1 To Len(Sentence)
If Mid(Sentence, Counter, 1) = Sign Then
'break loop on first equals sign.
Exit For
End If
Next Counter
If Counter <> Len(Sentence) Then
Rest = Right(Sentence, (Len(Sentence) - Counter))
Else
Rest = ""
End If
GetAfter = Rest
End Function
These two functions are usefull for reading .ini files. GetBefore returns everything in the string Comments
No comments yet — be the first to post one!
Post a Comment