Skip to content

Commit 677d081

Browse files
committed
Add support for the cyrillic characters in words() method for the
string and lodash plugins.
1 parent bd7854f commit 677d081

File tree

4 files changed

+4
-2
lines changed
  • lodash-plugin/src
  • string-plugin/src

4 files changed

+4
-2
lines changed

lodash-plugin/src/main/java/com/github/underscore/lodash/$.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class $<T> extends com.github.underscore.$<T> {
6161
put("\u00de", "Th"); put("\u00fe", "th");
6262
put("\u00df", "ss");
6363
} };
64-
private static String upper = "[A-Z\\xc0-\\xd6\\xd8-\\xde]";
64+
private static String upper = "[A-Z\\xc0-\\xd6\\xd8-\\xde\\u0400-\\u04FF]";
6565
private static String lower = "[a-z\\xdf-\\xf6\\xf8-\\xff]+";
6666
private static java.util.regex.Pattern reWords = java.util.regex.Pattern.compile(
6767
upper + "+(?=" + upper + lower + ")|" + upper + "?" + lower + "|" + upper + "+|[0-9]+");

lodash-plugin/src/test/java/com/github/underscore/lodash/StringTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ public void words() {
301301
assertEquals("[fred, barney, pebbles]", $.words("fred, barney, & pebbles").toString());
302302
assertEquals("[fred, barney, pebbles]", new $("fred, barney, & pebbles").words().toString());
303303
assertEquals("[fred, barney, pebbles]", $.chain("fred, barney, & pebbles").words().value().toString());
304+
assertEquals("[текст, на, русском]", $.words("текст, на, & русском").toString());
304305
assertEquals("[]", $.words(null).toString());
305306
}
306307

string-plugin/src/main/java/com/github/underscore/string/$.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class $<T> extends com.github.underscore.$<T> {
6161
put("\u00de", "Th"); put("\u00fe", "th");
6262
put("\u00df", "ss");
6363
} };
64-
private static String upper = "[A-Z\\xc0-\\xd6\\xd8-\\xde]";
64+
private static String upper = "[A-Z\\xc0-\\xd6\\xd8-\\xde\\u0400-\\u04FF]";
6565
private static String lower = "[a-z\\xdf-\\xf6\\xf8-\\xff]+";
6666
private static java.util.regex.Pattern reWords = java.util.regex.Pattern.compile(
6767
upper + "+(?=" + upper + lower + ")|" + upper + "?" + lower + "|" + upper + "+|[0-9]+");

string-plugin/src/test/java/com/github/underscore/string/StringTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ public void words() {
305305
assertEquals("[fred, barney, pebbles]", $.words("fred, barney, & pebbles").toString());
306306
assertEquals("[fred, barney, pebbles]", new $("fred, barney, & pebbles").words().toString());
307307
assertEquals("[fred, barney, pebbles]", $.chain("fred, barney, & pebbles").words().value().toString());
308+
assertEquals("[текст, на, русском]", $.words("текст, на, & русском").toString());
308309
assertEquals("[]", $.words(null).toString());
309310
}
310311

0 commit comments

Comments
 (0)