Move method to FCommons library

This commit is contained in:
filoghost 2021-07-05 08:27:29 +02:00
parent fca1de85e0
commit 43427d6f81
2 changed files with 3 additions and 13 deletions

View File

@ -51,8 +51,7 @@ public class InternalHologramEditor {
} }
message = Strings.capitalizeFirst(message); message = Strings.capitalizeFirst(message);
char lastChar = message.charAt(message.length() - 1); if (!Strings.hasSentenceEnding(message)) {
if (Character.isLetterOrDigit(lastChar)) {
message = message + "."; message = message + ".";
} }
return message; return message;

View File

@ -51,7 +51,7 @@ class MessagePartJoiner {
} }
private void appendMessagePart(String messagePart) { private void appendMessagePart(String messagePart) {
if (previousMessagePart == null || hasSentenceEnding(previousMessagePart)) { if (previousMessagePart == null || Strings.hasSentenceEnding(previousMessagePart)) {
output.append(Strings.capitalizeFirst(messagePart)); output.append(Strings.capitalizeFirst(messagePart));
} else { } else {
output.append(messagePart); output.append(messagePart);
@ -63,7 +63,7 @@ class MessagePartJoiner {
return; return;
} }
if (hasSentenceEnding(previousMessagePart)) { if (Strings.hasSentenceEnding(previousMessagePart)) {
output.append(" "); output.append(" ");
this.appendedFirstSentenceSeparator = false; 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() { private String build() {
return output.toString(); return output.toString();
} }