Added support for decDecode

This commit is contained in:
Shekhar Gulati
2016-05-16 19:42:57 +05:30
parent 8e8c4c07c4
commit 8d58231e92
2 changed files with 23 additions and 1 deletions
+15 -1
View File
@@ -345,7 +345,21 @@ public abstract class Strman {
return value.chars().mapToObj(ch -> leftPad(Integer.toBinaryString(ch), "0", 16)).collect(joining());
}
public static String leftPad(String value, String pad, int length) {
/**
* Convert decimal unicode (16 digits) string to string chars
*
* @param value The value to decode
* @return decoded String
*/
public static String decDecode(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return Arrays
.stream(value.split("(?<=\\G.{5})"))
.map(data -> String.valueOf(Character.toChars(Integer.parseInt(data))))
.collect(joining());
}
public static String leftPad(final String value, final String pad, final int length) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (value.length() >= length) {
return value;