October 9th, 2002, 11:39 PM
check if a string is more than 30 chars
How do i do a check to see if the user input string is more than 30 chars without the inclusion of spaces.
Eg 1: abcdefghijklm nopqrstuvwxyz 12345 (this string contains 31 chars not including sapces and will be disallowed)
Eg2: 1234567890 1234567890 123456789 (this string contains 29 chars not including sapces and therefore it is allowed.)
Thanks... pls help asap...
Codes will be very helpful
October 10th, 2002, 02:41 AM
Step 1: Use a StringTokenizer to split the string apart on the spaces.
Step 2: Use a while loop to the put the string back together without spaces.
Step 3: Use length() to test the new string.
I know you can do this. I have faith .