• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I compare two different string with unordered  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String s1 = "Hello Java";
String s2 = "Java Hello";

When compare this two String object values should be true. the order has been changed. Please could someone help on this.
 
Saloon Keeper
Posts: 7994
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Settu, welcome to CodeRanch.

The order of what has changed? The letters? The words? Define the problem clearly and unambiguously.

Also, you should show us what you've tried so far, and what problems you're facing.
 
Marshal
Posts: 4053
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When comparing two collections of things where the order of the contents is not important the general approach is to order both collections and then compare them. So given that you might think of a String as a collection of characters, how do you think you might go about solving your problem?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!