pike.git / lib / modules / String.pmod

version» Context lines:

pike.git/lib/modules/String.pmod:224:    fuzz = low_fuzzymatch(a, b);    fuzz += low_fuzzymatch(b, a);    fuzz = fuzz*100/(strlen(a)+strlen(b));    }       return fuzz;   }      //! Trim leading and trailing spaces and tabs from the string @[s].   //! - string trim_whites(string s) - { -  if (stringp(s)) { -  sscanf(s, "%*[ \t]%s", s); -  string rev = reverse(s); -  sscanf(rev, "%*[ \t]%s", rev); -  return s[..strlen(rev) - 1]; -  } + constant trim_whites = __builtin.string_trim_whites;    -  return s; - } -  +    //! Trim leading and trailing white spaces characters (@tt{" \t\r\n"@}) from   //! the string @[s].   //! - string trim_all_whites(string s) - { -  if (stringp(s)) { -  sscanf(s, "%*[ \t\r\n]%s", s); -  string rev = reverse(s); -  sscanf(rev, "%*[ \t\r\n]%s", rev); -  return s[..strlen(rev) - 1]; -  } + constant trim_all_whites = __builtin.string_trim_all_whites;    -  return s; - } -  +    //! Returns the soundex value of @[word] according to   //! the original Soundex algorithm, patented by Margaret O┬┤Dell   //! and Robert C. Russel in 1918. The method is based on the phonetic   //! classification of sounds by how they are made.   string soundex(string word) {    word = upper_case(word);    string first = word[0..0];    word = word[1..] - "A" - "E" - "H" - "I" - "O" - "U" - "W" - "Y";    word = replace(word, ([ "B":"1", "F":"1", "P":"1", "V":"1",    "C":"2", "G":"2", "J":"2", "K":"2",    "Q":"2", "S":"2", "X":"2", "Z":"2",    "D":"3", "T":"3",    "L":"4",    "M":"5", "N":"5",    "R":"6" ]) );    word = replace(word, ({"11", "22", "33", "44", "55", "66" }),    ({"", "", "", "", "", "", }));    word+="000";    return first + word[..2];   }