Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "Hiabc", "abc" -> true
- "AbC", "HiaBc" -> true
- "abc", "abXabc" -> true
- "abc", "abXaXc" -> false
- String str1Lower = str1.toLowerCase();
- String str2Lower = str2.toLowerCase();
- if (str1Lower.endsWith(str2Lower) || str2Lower.endsWith(str2Lower) {
- System.out.println ("One of the strings is the end of the other");
- } else {
- System.out.println ("bummer.");
- }
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- String s1="abc";
- String s2="zzzABC";
- s1 = s1.toUpperCase(); //remember string immutable so have to assign once again
- s2 = s2.toUpperCase();
- if(s1.endsWith(s2) || s2.endsWith(s1))
- System.out.println("one of the string appears at the very end of others");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement