Skip to content

Commit

Permalink
Updates generateName function to capitalize the first letter of the n…
Browse files Browse the repository at this point in the history
…ame.
  • Loading branch information
Tyler MacEachern committed Jul 25, 2017
1 parent 581d1a7 commit bcb143c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/com/valkryst/generator/CombinatorialNameGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public String generateName(int length) {

sb.append(chooseRandomElementFrom(endings));

return sb.toString();
final String name = sb.toString();
// Capitalize the first letter of the name:
return name.substring(0, 1).toUpperCase() + name.substring(1);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/com/valkryst/generator/ConsonantVowelNameGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public String generateName(int length) {
}
}

return sb.substring(0, length);
final String name = sb.substring(0, length);
// Capitalize the first letter of the name:
return name.substring(0, 1).toUpperCase() + name.substring(1);
}
}
3 changes: 2 additions & 1 deletion src/com/valkryst/generator/GrammarNameGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public String generateName(int length) {
}
}

return longestResult;
// Capitalize the first letter of the name:
return longestResult.substring(0, 1).toUpperCase() + longestResult.substring(1);
}
}

0 comments on commit bcb143c

Please sign in to comment.