Sha256: 9b1ea6298d49c8e0fd565ca5b450fd2a3a133168f01e9dea147b76acde88923c

Contents?: true

Size: 469 Bytes

Versions: 125

Compression:

Stored size: 469 Bytes

Contents

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Acronym {
    public static String generate(String phrase){
        final Pattern BREAK_WORDS = Pattern.compile("[A-Z]+[a-z]*|[a-z]+");
        final Matcher matcher = BREAK_WORDS.matcher(phrase);
        final StringBuilder b = new StringBuilder();
        while (matcher.find()){
            b.append(matcher.group().charAt(0));
        }
        return b.toString().toUpperCase();
    }
}

Version data entries

125 entries across 125 versions & 1 rubygems

Version Path
trackler-2.0.8.24 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.23 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.22 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.21 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.20 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.19 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.18 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.17 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.16 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.15 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.14 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.13 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.12 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.11 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.10 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.9 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.8 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.7 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.6 tracks/java/exercises/acronym/src/example/java/Acronym.java
trackler-2.0.8.5 tracks/java/exercises/acronym/src/example/java/Acronym.java