Created
July 19, 2017 14:25
-
-
Save nuryslyrt/303cdd776fb2e4fd87129063ab7cf25f to your computer and use it in GitHub Desktop.
Hex Encoding for String in \x format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String hexEncode(String input) { | |
String out = ""; | |
for (char c : input.toCharArray()) { | |
out += "\\x" + String.format("%x", new BigInteger(1, input.getBytes(/YOUR_CHARSET?/))); | |
} | |
return out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment