1. No Profile Picture
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Rep Power

    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
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Sacramento, CA
    Rep Power
    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 .

IMN logo majestic logo threadwatch logo seochat tools logo