2009-08-12 8 views

答えて

14

Matcherを作成し、find()を使用して次の一致時に配置します。ここで

15

は、コードサンプルです:

int countMatches(Pattern pattern, String str) { 
    int matches = 0; 
    Matcher matcher = pattern.matcher(str); 
    while (matcher.find()) 
    matches++; 
    return matches; 
} 
関連する問題