mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 16:49:10 +00:00
SDN Scripts title & description hex decoding added
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package org.parabot.environment.api.utils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mkyong
|
||||
*
|
||||
*/
|
||||
public class StringUtils {
|
||||
|
||||
public static String convertHexToString(String hex) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder temp = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < hex.length() - 1; i += 2) {
|
||||
|
||||
// grab the hex in pairs
|
||||
String output = hex.substring(i, (i + 2));
|
||||
// convert hex to decimal
|
||||
int decimal = Integer.parseInt(output, 16);
|
||||
// convert the decimal to character
|
||||
sb.append((char) decimal);
|
||||
|
||||
temp.append(decimal);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user