This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

length

 
Bob Holland
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes its something like that. The JavaDocs for the String class will tell you for certain.
 
Bob Holland
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 682
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3061
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic