public class LegacyStringUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LegacyStringUtils.LegacyStyle |
| Constructor and Description |
|---|
LegacyStringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static LegacyStringUtils.LegacyStyle |
getStyleAt(java.lang.String s,
int position,
boolean unknownWhite)
Get the legacy style of a string at the given position.
|
static LegacyStringUtils.LegacyStyle |
getStyleAt(java.lang.String s,
int position,
java.util.function.Function<java.lang.Character,net.lenni0451.mcstructs.core.TextFormatting> formattingResolver)
Get the legacy style of a string at the given position.
|
static java.lang.String[] |
split(java.lang.String s,
java.lang.String split,
boolean unknownWhite)
Split a string by a given split string and keep the legacy style of the previous part.
|
static java.lang.String[] |
split(java.lang.String s,
java.lang.String split,
java.util.function.Function<java.lang.Character,net.lenni0451.mcstructs.core.TextFormatting> formattingResolver)
Split a string by a given split string and keep the legacy style of the previous part.
|
public static LegacyStringUtils.LegacyStyle getStyleAt(java.lang.String s, int position, boolean unknownWhite)
TextFormatting.WHITE.s - The string to get the style fromposition - The position to get the style atunknownWhite - Handle unknown formatting codes as resetpublic static LegacyStringUtils.LegacyStyle getStyleAt(java.lang.String s, int position, java.util.function.Function<java.lang.Character,net.lenni0451.mcstructs.core.TextFormatting> formattingResolver)
formattingResolver should return a formatting for the given char or null if the previous formatting should be kept.bold, italic, etc. will be reset.s - The string to get the style fromposition - The position to get the style atformattingResolver - The function that resolves the formatting for the given charpublic static java.lang.String[] split(java.lang.String s,
java.lang.String split,
boolean unknownWhite)
TextFormatting.RESET.s - The string to splitsplit - The split stringunknownWhite - Handle unknown formatting codes as resetpublic static java.lang.String[] split(java.lang.String s,
java.lang.String split,
java.util.function.Function<java.lang.Character,net.lenni0451.mcstructs.core.TextFormatting> formattingResolver)
formattingResolver should return a formatting for the given char or null if the previous formatting should be kept.bold, italic, etc. will be reset.s - The string to splitsplit - The split stringformattingResolver - The function that resolves the formatting for the given char