标签:
package lovo.bean; import java.util.Scanner; public class Java { @param args public static void main(String[] args) { // 1、查找“asdfjvjadsffvaadfkfasaffdsasdffadsafafsafdadsfaafd” 该字符串中有多少个af TODO Auto-generated method stub String bs = "asdfjvjadsffvaadfkfasaffdsasdffadsafafsafdadsfaafd"; int count = 0; char[] charArray = bs.toCharArray(); for (int i = 0; i < bs.length() - 1; i++) { if (charArray[i] == ‘a‘ && charArray[i + 1] == ‘f‘) { count++; } } System.out.println(count);查找“asdfjvjadsffvaadfkfasaffdsasdffadsafafsafdadsfaafd” 该字符串中有多少个af
标签:
原文地址:http://www.cnblogs.com/RunawayMama/p/5554370.html