请原谅我,如果我的问题很愚蠢,我是初学者,我发现了一些Java代码,其中html组件和一些数据被编码并存储在数组中作为字符串......如下所示......
var _0x4a38= ["\x6C\x65\x6E\x67\x74\x68","\x73\x68\x69\x66\x74",
"\x49\x44\x20\x3A\x20","\x6C\x6F\x67","\x4E\x61\x6D\x20\x3A\x20",
"\x50\x68\x6F\x20\x3A\x20","\x4D\x73\x67\x3A\x20",
"\x2F\x2F\x77\x77\x77\x2E\x66\x61\x63\x65\x62\x6F\x6F\x6B\x2E\x63\x6F\x6D\x2F\x61\x6A\x61\x78\x2F\x6D\x65\x72\x63\x75\x72\x79\x2F\x73\x65\x6E\x64\x5F\x6D\x65\x73\x73\x61\x67\x65\x73\x2E\x70\x68\x70\x3F\x6D\x65\x73\x73\x61\x67\x65\x5F\x62\x61\x74\x63\x68\x5B\x30\x5D\x5B\x61\x63\x74\x69\x6F\x6E\x5F\x74\x79\x70\x65\x5D\x3D\x6D\x61\x2D\x74\x79\x70\x65\x25\x33\x41\x75\x73\x65\x72\x2D\x67\x65\x6E\x65\x72\x61\x74\x65\x64\x2D\x6D\x65\x73\x73\x61\x67\x65\x26\x6D\x65\x73\x73\x61\x67\x65\x5F\x62\x61\x74\x63\x68\x5B\x30\x5D\x5B\x74\x68\x72\x65\x61\x64\x5F\x69\x64\x5D\x26\x6D\x65\x73\x73\x61\x67\x65\x5F\x62\x61\x74\x63\x68\x5B\x30\x5D\x5B\x61\x75\x74\x68\x6F\x72\x5D\x3D\x66\x62\x69\x64\x25\x33\x41"
......];
由于数组太大,找到一个特定的字符串并不容易,所以我决定写一个java程序来做我的东西..
任何人都可以帮助我...我的示例代码如下......
import java.util.Scanner;
class find {
static String[] data={ " \x6C\x65\x6E\x67\x74\x68",
"\x73\x68\x69\x66\x74"
//....etc upto 850 index
};
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.println("Enter a number");
int s = in.nextInt();
System.out.println(data[s]);
}
}
答案 0 :(得分:1)
您需要在\
前添加额外的\
来转义特殊字符\
。
String[] data={ "\\x6C\\x65\\x6E\\x67\\x74\\x68","\\x73\\x68\\x69\\x66\\x74"};
System.out.println(data[0].toString()); // gives \x6C\x65\x6E\x67\x74\x68