Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Created April 2, 2017 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitherejoe/4adf3f06904b9c6404f08443e3024a22 to your computer and use it in GitHub Desktop.
Save hitherejoe/4adf3f06904b9c6404f08443e3024a22 to your computer and use it in GitHub Desktop.
public List<String> mapFromWords(String... words) {
List<String> braille = new ArrayList<>();
for (int i = 0; i < words.length; i++) {
braille.addAll(mapFromString(words[i]));
if (i < words.length - 1) braille.add(Braille.SPACE.getValue());
}
return braille;
}
public List<String> mapFromString(String text) {
List<String> braille = new ArrayList<>();
for (int i = 0; i < text.length(); i++) {
braille.add(Braille.fromKey(
Character.toLowerCase(text.charAt(i))).getValue());
}
return braille;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment