This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes length Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "length" Watch "length" New topic
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
 
wood burning stoves
 
subject: length
 
Similar Threads
WA #1.....word association
regard on k&b book
Home loans in India - fixed or floating ?
Running two threads
Dont declare global variables in Servlet