Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Match{
- private static boolean match(String string1,String string2){
- if (string1.length()>string2.length()){
- String temp = string1;
- string1 = string2;
- string2 = temp;
- }
- int length1 = string1.length();
- int length2 = string2.length();
- int index = 0;
- boolean match = false;
- for(int x=0;x<=length2-1;x++){
- if (index>length1-1) return match;
- if (string2.charAt(x) == (string1.charAt(index))){
- index++;
- match = true;
- }
- else{
- index=0;
- }
- }
- return match;
- }
- public static void main(String args[]){
- System.out.println(match("yes","noyessssoo"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement