Skip to content

Commit bcb143c

Browse files
author
Tyler MacEachern
committed
Updates generateName function to capitalize the first letter of the name.
1 parent 581d1a7 commit bcb143c

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/com/valkryst/generator/CombinatorialNameGenerator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ public String generateName(int length) {
8585

8686
sb.append(chooseRandomElementFrom(endings));
8787

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

9193
/**

src/com/valkryst/generator/ConsonantVowelNameGenerator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public String generateName(int length) {
5959
}
6060
}
6161

62-
return sb.substring(0, length);
62+
final String name = sb.substring(0, length);
63+
// Capitalize the first letter of the name:
64+
return name.substring(0, 1).toUpperCase() + name.substring(1);
6365
}
6466
}

src/com/valkryst/generator/GrammarNameGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public String generateName(int length) {
5454
}
5555
}
5656

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

0 commit comments

Comments
 (0)