As I understand it, the question would be.
//for each character in s1 //if s2 does not contain character return false //return true for(int i = 0; i < length s1; i++){ if(!s2.contains(String.valueOf(s1.charAt(i)))){ return false; } } return true;
This checks that every character in s1 is in s2. He does not confirm the order, nor how many are there, and is not a method of equals.
Recursive:
public static Boolean cmprStr( String s1, String s2 ) { if(s1.length() == 0 ) { return true; } if(!s2.contains(s1.substring(0,1))) { return false; } return cmprStr(s1.substring(1), s2); }
Speck source share