mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-16 07:25:10 +01:00
Move method to FCommons library
This commit is contained in:
parent
fca1de85e0
commit
43427d6f81
@ -51,8 +51,7 @@ public class InternalHologramEditor {
|
||||
}
|
||||
|
||||
message = Strings.capitalizeFirst(message);
|
||||
char lastChar = message.charAt(message.length() - 1);
|
||||
if (Character.isLetterOrDigit(lastChar)) {
|
||||
if (!Strings.hasSentenceEnding(message)) {
|
||||
message = message + ".";
|
||||
}
|
||||
return message;
|
||||
|
@ -51,7 +51,7 @@ class MessagePartJoiner {
|
||||
}
|
||||
|
||||
private void appendMessagePart(String messagePart) {
|
||||
if (previousMessagePart == null || hasSentenceEnding(previousMessagePart)) {
|
||||
if (previousMessagePart == null || Strings.hasSentenceEnding(previousMessagePart)) {
|
||||
output.append(Strings.capitalizeFirst(messagePart));
|
||||
} else {
|
||||
output.append(messagePart);
|
||||
@ -63,7 +63,7 @@ class MessagePartJoiner {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasSentenceEnding(previousMessagePart)) {
|
||||
if (Strings.hasSentenceEnding(previousMessagePart)) {
|
||||
output.append(" ");
|
||||
this.appendedFirstSentenceSeparator = false;
|
||||
|
||||
@ -76,15 +76,6 @@ class MessagePartJoiner {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasSentenceEnding(String s) {
|
||||
if (Strings.isEmpty(s)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char lastChar = s.charAt(s.length() - 1);
|
||||
return lastChar == '.' || lastChar == '?' || lastChar == '!';
|
||||
}
|
||||
|
||||
private String build() {
|
||||
return output.toString();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user