守着一只汪
如果像你说的:只要最前面连续的相同字符串去掉最好可以这样: String a = "今天天气很好我叫小王"; String b = "今天天气很好我叫大吴"; int length = Math.min(a.length(), b.length()); int pos = 0; while (pos < length) { if (0 != (a.charAt(pos) ^ b.charAt(pos))) { break; } pos++; } System.out.println(a.substring(pos)); System.out.println(b.substring(pos));要满足更大的需求,可能需要再发散一下