Skip to content
Snippets Groups Projects
Commit 06de904e authored by srosse's avatar srosse
Browse files

Merge OpenOLAT 9.3 to OpenOLAT default branch with 9a4a559b385ada2c4982f1a847a42c4ca97cc75d

parents 6ba5a6e2 af1ee7d5
No related branches found
No related tags found
No related merge requests found
......@@ -404,7 +404,7 @@ public class StringHelper {
char[] charArr = string.toCharArray();
for(int i=charArr.length; i-->stop; ) {
char ch = charArr[i];
if(ch < 47 || ch > 58) {
if(ch < 48 || ch > 57) {
return false;
}
}
......
......@@ -112,12 +112,20 @@ public class StringHelperTest {
@Test
public void isLong() {
Assert.assertTrue(StringHelper.isLong("234"));
Assert.assertTrue(StringHelper.isLong("0123456789"));
Assert.assertTrue(StringHelper.isLong("9223372036854775807"));
Assert.assertTrue(StringHelper.isLong("-9223372036854775807"));
//check some unacceptable strings
Assert.assertFalse(StringHelper.isLong("10223372036854775807"));
Assert.assertFalse(StringHelper.isLong("-dru"));
Assert.assertFalse(StringHelper.isLong("OpenOLAT"));
Assert.assertFalse(StringHelper.isLong("A very long number with a lot of characters"));
//check ascii range
Assert.assertFalse(StringHelper.isLong("/"));
Assert.assertFalse(StringHelper.isLong(":"));
Assert.assertFalse(StringHelper.isLong("."));
Assert.assertFalse(StringHelper.isLong(";"));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment