1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2024-12-26 07:38:36 -06:00

Now only lowercase letters and numbers are generated

This commit is contained in:
Przemek Dragańczuk 2020-02-16 15:58:37 +01:00
parent bde40b61e6
commit 8cd399d2e9

View file

@ -10,14 +10,12 @@ public class Utils {
int rightLimit = 122; // letter 'z' int rightLimit = 122; // letter 'z'
int targetStringLength = 10; int targetStringLength = 10;
String generatedString = random.ints(leftLimit, rightLimit + 1) return random.ints(leftLimit, rightLimit + 1)
.filter(i -> (i <= 57 || i >= 65) && (i <= 90 || i >= 97)) .filter(i -> (i <= 57 || i >= 97))
.limit(targetStringLength) .limit(targetStringLength)
.collect(StringBuilder::new, .collect(StringBuilder::new,
StringBuilder::appendCodePoint, StringBuilder::appendCodePoint,
StringBuilder::append) StringBuilder::append)
.toString(); .toString();
return generatedString;
} }
} }