Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7692795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:56:06+00:00 2026-05-31T20:56:06+00:00

How to check equality of two String objects independent of the char order? Examples:

  • 0

How to check equality of two String objects independent of the char order?

Examples:

checkEq(A*B'*C,B'*A*C) has to return true
checkEq(A*B'*C,A*B*C) ----> false... etc
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:56:07+00:00Added an answer on May 31, 2026 at 8:56 pm

    Try using the java str.split method. For instance, str.split("*") will give you an array of the elements A,B,C or B,A,C. And then just sort them and single loop through them once to compare them.

    String str1 = "A*B*C";
    String str2 = "C*A*B";
    
    // split strings into arrays
    String[] array1 = str1.split("*");
    String[] array2 = str2.split("*");
    
    // sort each array
    Arrays.sort(array1);
    Arrays.sort(array2);
    
    // compare arrays
    for( i=0; i<array1.length; i++ ){
       if(array1[i] == array2[i]){
           return false;   // OR, do whatever it is you want to do here.
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created an Address class like below,Then I wanted to check equality of two
I'm using MS SQL 2005, and I want to check two dates for equality,
I need to generate expression tree than checks two objects (arguments) for equality. I
I need to check equality between two MethodInfos. They are actually the exact same
Possible Duplicate: Java: Checking equality of arrays (order doesnt matter) I have two arrays
I know that the HashSet.contains() method uses the .equals method to check equality as
Is there any way in clojure to check the equality of strings? i.e. I
Check the below code int add(int a, int b) { return a + b;
I'm initializing an instance of a class that tests the equality of two formulas.
Is there a simple way to compare two EntityObjects for value-equality. I simply want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.