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

Compare Array with String

 
nani aman
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i have a string and an array of character.

String = "solve"
Array = {r,e,s,o,l,v,e}

how i can compare the string with the array to know that the string is in the array?

thank you. :roll:
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest that you have a look at the charAt method in java.lang.String class, and the String constructor that takes a character array as input.
 
Rohan Kayan
Ranch Hand
Posts: 123
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a new String object with char[] in its constructor and then you can use
public int compareTo(String anotherString)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic