| Author |
length
|
Bob Holland
Greenhorn
Joined: Dec 15, 2004
Posts: 7
|
|
hi again, what is the syntax to chech that a string variable has the right ammount of charcters, i think its something like if (variable lenght < 0) thanks in advance Bob
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Yes its something like that. The JavaDocs for the String class will tell you for certain.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Bob Holland
Greenhorn
Joined: Dec 15, 2004
Posts: 7
|
|
hi,, i cant find the syntax there anywhere what i want it to do is if the variable is less than 13 charachters long then print an error,
|
 |
Nigel Browne
Ranch Hand
Joined: May 15, 2001
Posts: 673
|
|
Originally posted by Bob Holland: hi,, i cant find the syntax there anywhere
Did you look at the method length ? length() Returns the length of this string.
|
 |
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
|
|
Remember that String is a class, so when you find a method name to use with it, the syntax is exactly the same as calling a method on any other class. Keep Coding! Layne
|
Java API Documentation
The Java Tutorial
|
 |
 |
|
|
subject: length
|
|
|