有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (2) 个答案

  1. # 1 楼答案

    我想我们可以在for-loop中使用substring(int begIndex, int endIndex),从0到length()。不过我不确定

  2. # 2 楼答案

    如果有人需要,可以找到:p amm现在只需要让它递归,如果有人需要帮助:P hhh

    public static int howmany(String word, String pattern) {
          int count = 0;
          int strLen = word.length();
          int patLen = pattern.length();
          for(int i = 1;i<=pattern.length();i++){
              for(int j = 1;j<=word.length();j++){
               if(str.charAt(strLen-j)==pattern.charAt(patLen-i)){
                     count++;
                }
               }
          }                       
          return count;
    }