2009-08-12 9 views

risposta

14

Creare un coordinatore e utilizzare find() per posizionarlo nella corrispondenza successiva.

15

Ecco un esempio di codice:

int countMatches(Pattern pattern, String str) { 
    int matches = 0; 
    Matcher matcher = pattern.matcher(str); 
    while (matcher.find()) 
    matches++; 
    return matches; 
} 
Problemi correlati