51,408
社区成员
发帖
与我相关
我的任务
分享
String name = "http://www.csdn.net";
int zIdx = name.indexOf(0);
if (zIdx != -1)
return null;
int a = '0';
char b = 0;
char c = '\u0000';
int d = ' ';
Object e = null;
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
System.out.println(e);
String name = b+"www.csdn.net";
int zIdx = name.indexOf(0);
System.out.println(zIdx);
if (zIdx != -1)
System.out.println("成立!");
//打印出来看看呗
System.out.println((char)0);
private static String normalizeName(String name) {
int cppIdx = name.indexOf("://");
if (cppIdx > 0) {
int zIdx = name.indexOf(0);
if (zIdx != -1 && zIdx < cppIdx) return null;
return name;
}
for(;;) {
int parentDirPathLoc = name.indexOf(PARENT_DIR_PATH);
if(parentDirPathLoc == 0) {
// If it starts with /../, then it reaches outside the template
// root.
return null;
}
if(parentDirPathLoc == -1) {
if(name.startsWith(PARENT_DIR_PATH_PREFIX)) {
// Another attempt to reach out of template root.
return null;
}
break;
}
int previousSlashLoc = name.lastIndexOf(SLASH, parentDirPathLoc - 1);
name = name.substring(0, previousSlashLoc + 1) +
name.substring(parentDirPathLoc + PARENT_DIR_PATH.length());
}
for(;;) {
int currentDirPathLoc = name.indexOf(CURRENT_DIR_PATH);
if(currentDirPathLoc == -1) {
if(name.startsWith(CURRENT_DIR_PATH_PREFIX)) {
name = name.substring(CURRENT_DIR_PATH_PREFIX.length());
}
break;
}
name = name.substring(0, currentDirPathLoc) +
name.substring(currentDirPathLoc + CURRENT_DIR_PATH.length() - 1);
}
// Editing can leave us with a leading slash; strip it.
if(name.length() > 1 && name.charAt(0) == SLASH) {
name = name.substring(1);
}
return name;
}
int a = 'a'; 没错