comlen function in Java
        Posted  
        
            by davit-datuashvili
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by davit-datuashvili
        
        
        
        Published on 2010-06-02T19:24:18Z
        Indexed on 
            2010/06/02
            19:54 UTC
        
        
        Read the original article
        Hit count: 180
        
in c or c++
the  function comlen is defined  such
int comlen(char *p,char *q){
   int i=0;
   while  *p && (*p++==*q++)
      i++;
   return i;
}
Is this code equivalent of this function?
int comlen(String s,String m){
   int  i=0;
   while (i<s.length() && s.charAt(i)==m.charAt(i)){
      i++;
   }
   return i;
}
© Stack Overflow or respective owner