Java comparator for String in EBCDIC encoding -
i have come across requirement need convert string ebcdic encoding , sort it. need sort ebcdic because string has go in mainframe. string sort have alphabets in captial , integers only.
i googled , came across link ibm has listed characters in order
what realized ebcdic sorting opposite normal java lexicographic sorting (at least type of data going process).
my question realization right ? if not missing ? or there java comparator available ebcdic encoding.
since char type implicitly utf-16 in java ebcdic strings need compared java byte arrays.
example:
charset encoding = charset.forname("ibm1047"); comparator<string> enccomparator = (s1, s2) -> encoding.encode(s1) .compareto(encoding.encode(s2));
Comments
Post a Comment