Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

has contain method for String?

 
sam cen
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do test whether a string contain charater 'a' or 'b' for example?
just want to check with all of you about, does JKD provide contain method for Sting,
Or I need to do coding for this.
thanks
Sam
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
indexOf will return the index of the first position of the character, or -1 if it was not found.
Dave
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the JDK 1.4 API for more details.
And remember the String class is immutable, so if you're doing a lot of String manipulation, the StringBuffer class is much more efficient and better suited.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic