public static Boolean cmprStr( String s1, String s2 )
{
// STUFF
}
I want to iterate through s1 to make sure that every character in s1 is incl
As I understand the question it 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 verifies that each character in s1 is in s2. It does not confirm order, nor how many are there, and is not an equals method.
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);
}