M3hcSS
asked on
Given a variable length string (11:15 OR 9:30), how do I use Substring to pull out the first number?
This works if the hour is 11:15
myTime.Substring(0,2)
This works if the hour is 9:30
myTime.Substring(0,1)
How do I make it so it works with either string? I don't know ahead of time how long the string is.
myTime.Substring(0,2)
This works if the hour is 9:30
myTime.Substring(0,1)
How do I make it so it works with either string? I don't know ahead of time how long the string is.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
To get the minutes to the right side of the colon...
JUNKTimeOn1.Substring((JUN KTimeOn1.I ndexOf(":" )+1),2)
JUNKTimeOn1.Substring((JUN
ASKER