Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int stringMatch(String a, String b) {
- int checkNum=0;
- String shorter= "";
- if (a.length()<= b.length()){
- shorter= a;
- }
- else{
- shorter= b;
- }
- for (int i=0; i<shorter.length()-1; i++){
- if( a.substring(i,i+2).equals(b.substring(i,i+2))){
- checkNum++;
- }
- }
- return checkNum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement