Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. public int stringMatch(String a, String b) {
  2. int checkNum=0;
  3. String shorter= "";
  4. if (a.length()<= b.length()){
  5. shorter= a;
  6. }
  7. else{
  8. shorter= b;
  9. }
  10.  
  11. for (int i=0; i<shorter.length()-1; i++){
  12. if( a.substring(i,i+2).equals(b.substring(i,i+2))){
  13. checkNum++;
  14. }
  15. }
  16. return checkNum;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement