日期:2014-05-20 浏览次数:20833 次
public static void main(String[] args) { System.out.println(charContains("I1I2I3", "I1I3")); } public static boolean charContains(String s, String sub) { if (s == null || sub == null) return false; for (int i = 0; i < sub.length(); i++) { boolean contains = false; char c = sub.charAt(i); for (int j = 0; j < s.length(); j++) { if (c == s.charAt(j)) { contains = true; break; } } if (!contains) return false; } return true; }