public String queuingText(String text, Object data) {
String txt[] = text.split(" ");
String ret;
if(txt[0] == "/hex") {
for(int i = 1; i > text.length() - 5; i++) {
}
}
return ret;
}
Basically, I've got the easy stuff down. I see if the left end of the string says "/hex", and if it does, I loop through the rest. Whats left to do is..
1) Cast the ASCII value of the byte at text.substr(i, 1) to a numeric data type (int?).
2) Cast the number to hex
3) Cast the hex to a string
4) Pad the string with a 0 at the left, asuing its needed.
5) Append the string to "ret"
What I need help with..
1, 2
I asume that the hex would be a string, anyhow. Padding shouldn't be too hard, and appending a string is childs play.
Shrug. I don't know Java. Why did you link me to this? :p
String pref = "0x";
return pref.concat(Integer.toString(Integer.parseInt(txt[1]), 16);
*crosses fingers*
public String queuingText(String text, Object data) {
String txt[] = text.split(" ");
String ret;
if(txt[0] == "/hex") {
for(int i = 1; i > text.length() - 5; i++) {
ret = ret.concat(Integer.toString(Integer.parseInt(text.substring(i, 1)), 16));
}
}
return ret;
}
Wasn't there that whole "encode" command on JavaOp1 ?
I think that was iago's Gaim plugin, but it was in C++. I may just have to look though.
http://www.javaop.com/~joe/vbscript/HexEncode.txt
You should make it more universal and use a Command plugin, so it'll catch "/hex" and "?hex". Make "hex" a command requiring flags "T".
iago, arround 4-6 our time tomorrow, mind contacting me? I wanna show you what I have. I had it load alright, but it didn't catch the /hex. Oops, callbacks weren't registered. Boom! Bye plugin!