Select Case Question: Match String Contains?

flyingbag

Member
Licensed User
Longtime User
Hi
I am trying to do something like the following:
B4X:
Select sMsg
    Case sMsg.Contains("MyString")
         <DoSomethingHere>

However - it does not work.
Any way to do this using Select Case?

I tried Case ( sMsg.Contains("MyString") ) - but that doesnt work too

Thanks
flyingbag
 

klaus

Expert
Licensed User
Longtime User
Try this one:
B4X:
Select True
    Case sMsg.Contains("MyString")
         <DoSomethingHere>
sMsg is a string but sMsg.Contains("MyString") returns a boolean. That's the reason why it doesn't work.

Best regards.
 
Upvote 0

flyingbag

Member
Licensed User
Longtime User
Thanks for the quick response ... Logically it does make sense

I tried this with Select True, but it doesnt work... :(

CORRECTION : I think i have some other problems in my code for now ... will try this again and revert ( it should work) Sorry about the wrong post earlier
 
Last edited:
Upvote 0

flyingbag

Member
Licensed User
Longtime User
Apologies Klaus, works fine...
The "echo" from my server and the string i was trying to Match was different - hence it was failing (as i said - problem in my code)

Thank you!
 
Upvote 0
Top