Skip to content

Commit

Permalink
Merge pull request #77 from Codeforces/dev-mikemirzayanov
Browse files Browse the repository at this point in the history
Dev mikemirzayanov
  • Loading branch information
MikeMirzayanov committed Dec 7, 2023
2 parents a26efcf + 790f7a7 commit 04329ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public final class StringUtil {
private static final Logger logger = Logger.getLogger(StringUtil.class);

private static final Pattern FORMAT_COMMENTS_COMMENT_SPLIT_PATTERN = Pattern.compile("\\[pre]|\\[/pre]");
private static final Pattern FORMAT_COMMENTS_LINE_BREAK_REPLACE_PATTERN = Pattern.compile("[\n\r][\n\r]+");
private static final Pattern FORMAT_COMMENTS_LINE_BREAK_REPLACE_PATTERN = Pattern.compile("[\n\r][\\s\\u200B]*[\n\r]+");

private static final Map<Class, ToStringConverter> toStringConverterByClass = new HashMap<>();
private static final ReadWriteLock toStringConverterByClassMapLock = new ReentrantReadWriteLock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,11 @@ private static void internalTestLooksLikeUtilDifferent(String... strings) {
private static void internalTestSplit(String s, char c, String[] parts) {
assertArrayEquals("Illegal split of '" + s + "' by '" + c + "'.", parts, StringUtil.split(s, c));
}

@Test
public void testWellformForWindows() {
assertEquals("1\r\n", StringUtil.wellformForWindows("\r\n\r\n 1 \r\n \r\n "));
assertEquals("a b c\r\nd e\r\n", StringUtil.wellformForWindows("\r\n\r\n a b c \r\n d e"));
assertEquals("a b c\r\n\r\nd e\r\n", StringUtil.wellformForWindows("a b c\r\n\r\nd e\r\n"));
}
}

0 comments on commit 04329ed

Please sign in to comment.