title: How to check that 2 strings are actually equal and have same characters? Even with spacing or lowercase
body: <p>Can anyone help me? I am trying to compare 2 strings if its equal or not (without considering spaces and cases)</p>
  <p>Examples:</p>
  <blockquote>
  <p>&quot;Abc1&quot;, &quot;Abc1 &quot; -&gt; true (with spacing at the end)</p>
  <p>&quot;Abc1&quot;, &quot;abc1&quot;  -&gt; true (with lowercase)</p>
  <p>&quot;Abc1&quot;, &quot; Abc1 &quot; -&gt; true (with spacing at the beginning and at the end
  of the string)</p>
  <p>&quot;Abc1&quot;, &quot; abc1 &quot; -&gt; true (with lowercase and spacing at the beginning
  and at the end of the string)</p>
  </blockquote>
  <p>It should have the same order, and if its not the same order, it will returns false</p>
  <blockquote>
  <p>&quot;Abc1&quot;, &quot;Ac1b &quot; -&gt; false</p>
  </blockquote>
  <p>I already tried this code, but it didnt give me the result I was looking for</p>
  <pre><code>public static boolean sameChars(String firstStr, String secondStr) {
      char[] first = firstStr.toCharArray();
      char[] second = secondStr.toCharArray();
      Arrays.sort(first);
      Arrays.sort(second);
      return Arrays.equals(first, second);
  }
  </code></pre>