aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "length" Watch "length" New topic


Bob Holland

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

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

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!


Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: length
Similar Threads
Home loans in India - fixed or floating ?
Running two threads
Dont declare global variables in Servlet
regard on k&b book
WA #1.....word association