Skip to content

Commit

Permalink
Remove "CR" at the end of strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Jan 26, 2019
1 parent 586b076 commit d3ae242
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/world/bentobox/challenges/utils/GuiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,15 @@ private static BorderBlock getPanelBorder(Material material)
*/
public static List<String> stringSplit(String string)
{
// Remove all ending lines from string.
string = string.replaceAll("([\\r\\n])", "\\|");
string = ChatColor.translateAlternateColorCodes('&', string);
// Check length of lines
List<String> result = new ArrayList<>();

Arrays.asList(string.split("\\|")).
forEach(line -> result.addAll(
Arrays.asList(WordUtils.wrap(line, 25).split("\\n"))));
Arrays.stream(string.split("\\|")).
map(line -> Arrays.asList(WordUtils.wrap(line, 25).split("\\r\\n"))).
forEach(result::addAll);

return result;
}
Expand Down

0 comments on commit d3ae242

Please sign in to comment.