Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

java string

Options
  • 23-10-2011 5:55pm
    #1
    Registered Users Posts: 2,315 ✭✭✭


    Hi, i'm new to java and have been trying to find an answer to a problem.
    I'm trying to do a check that a string variable is 16 characters long. I havent been having any luck with it so far. Would anyone have any pointers to help me?


Comments

  • Closed Accounts Posts: 20,759 ✭✭✭✭dlofnep


    Use the .length() method to determine the length of the string.


  • Closed Accounts Posts: 1,990 ✭✭✭JustAddWater


    dlofnep wrote: »
    Use the .length() method to determine the length of the string.

    Exactly. Set an int to the strings' .length() and if int == 16 then do whatever you wanted the program to do

    If your stuck, post some code and we'll take a look for you :)


  • Registered Users Posts: 2,315 ✭✭✭deceit


    Exactly. Set an int to the strings' .length() and if int == 16 then do whatever you wanted the program to do

    If your stuck, post some code and we'll take a look for you :)

    Cool guys thanks for both your help, i've got it running :D:).


Advertisement