Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

How to check if a string value contains all of the same character ?

In VB.net, Suppose I am accepting user input as a string. I need to check for a value of Zero. However it is possible that someone could enter "000000", or "000",
Which I would consider as valid because when converted to an integer, they are equivalent. 0 = 0

Without converting this input value "000000" to an integer, what would be a good way to check if the entire string contains only the character(s) "0"
SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brgdotnet

ASKER

Thanks to both of you! Both solutions were very nice. I think I will use the one Bill provided.
Avatar of Bill Prew
Bill Prew

Welcome, glad that helped.


»bp
Are you looking at a large string (like a paragraph) or just a textbox?