String manipulation

Shay

Well-Known Member
Licensed User
Longtime User
Hi

I found several posts, but none was helpful
looking to do:
from the click demo code, I have the stopper which is
Chrono.text - giving for example 12:30 (12m30s)
I wish to get the "12"
how do I do that?

Thanks
 

klaus

Expert
Licensed User
Longtime User
You have several possibilities:

txt1 = "12:30"

if there are always 2 characters for the hour (08:30)
txt = txt1.SubString2(0,2)

if there can be 1 or 2 characters for the hour (8:30)
txt = txt1.SubString2(0,txt1.IndexOf(":"))

Best regards.
 
Last edited:
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
You have several possibilities:

txt1 = "12:30"

if there are always 2 characters for the hour (08:30)
txt = txt1.SubString2(0,2)

if there can be 1 or 2 characters for the hour (8:30)
txt = txt1.SubString2(0,txt1.InsexOf(":"))

Best regards.
An amusing slip by Klaus, should of course have been IndexOf.
 
Upvote 0
Top