Last post Apr 24, 2008 08:17 AM by ramireddyindia
Apr 24, 2008 06:53 AM|polynaux|LINK
I have written this little IF..THEN statement and a function that should trim the item in a list.
Where the List contains items like: userinput "helloworld" and I added + "_3345" + secretwordString
Case Is = "THEN" 'Operator 2 is THEN
If TrimListItem(ListOfAlternativesSet.Contains(Rulerow.Cells(3).Text)) Then
Result = "itze" 'Rulerow.Cells(11).Text '3_3True
Result = "FALSE"
Private Shared Function TrimListItem(ByVal s As String) _
' AndAlso prevents evaluation of the second Boolean
' expression if the string is so short that an error
' would occur.
If (s.Length > 5) AndAlso _
(s.Substring(s.Length - 8)) Then
For the comparison that happens in my IF THEN statemetn I just check if the userinput equals the row in my gridview BUT there is the problem, I added the secret word.
Thats why I have my function. But instead of trimming of the last 8 characters I need to trim everything after the occurence of "_3345" including the "_3345" itstelf.
How can I do that ?
Many thanks for your help,
Apr 24, 2008 08:17 AM|ramireddyindia|LINK
vStr = vStr.Substring(0,vStr.IndexOf(
output: vstr = "ram"