资 源 简 介
multiinterfaces.zipgBuffer searchMe = new StringBuffer(
"peter piper picked a peck of pickled peppers")
int max = searchMe.length()
int numPs = 0
for (int i = 0 i < max i++) {
//interested only in p s
if (searchMe.charAt(i) != p )
continue
//process p s
numPs++
searchMe.setCharAt(i, P )
}
System.out.println("Found " + numPs + " p s in the string.")
System.out.println(searchMe)
}
}
-multiinterfaces.zipgBuffer searchMe = n ew StringBuffer ( "peter piper picked a peck of p ickled peppers ") searchMe.length max = int () i nt = 0 numPs for (int i = 0 i