mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-24 19:45:14 +01:00
Remove "CR" at the end of strings.
This commit is contained in:
parent
586b076860
commit
d3ae242716
@ -374,13 +374,15 @@ public class GuiUtils
|
|||||||
*/
|
*/
|
||||||
public static List<String> stringSplit(String string)
|
public static List<String> stringSplit(String string)
|
||||||
{
|
{
|
||||||
|
// Remove all ending lines from string.
|
||||||
|
string = string.replaceAll("([\\r\\n])", "\\|");
|
||||||
string = ChatColor.translateAlternateColorCodes('&', string);
|
string = ChatColor.translateAlternateColorCodes('&', string);
|
||||||
// Check length of lines
|
// Check length of lines
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
|
|
||||||
Arrays.asList(string.split("\\|")).
|
Arrays.stream(string.split("\\|")).
|
||||||
forEach(line -> result.addAll(
|
map(line -> Arrays.asList(WordUtils.wrap(line, 25).split("\\r\\n"))).
|
||||||
Arrays.asList(WordUtils.wrap(line, 25).split("\\n"))));
|
forEach(result::addAll);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user