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);
|
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;
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user