字串處理練習

2021-05-26 09:30:13 字數 696 閱讀 6840

public class countchar 

private static void usecharat(string str) else if (c >= 'a' && c <= 'z') else

}system.out.println("lowercount:" + lowercount + " uppercount:" + uppercount + " othercount:" + othercount);

}private static void useindexof(string str) else if (upperstr.indexof(c) != -1) else

}system.out.println("lowercount:" + lowercount + " uppercount:" + uppercount + " othercount:" + othercount);

}private static void useislowerorupper(string str) else if (character.isuppercase(c)) else

}system.out.println("lowercount:" + lowercount + " uppercount:" + uppercount + " othercount:" + othercount);

}}

for迴圈練習及字串處理

今天主要是做了一些for迴圈習題的練習,以及學習了一些字串處理。先看一下字串處理 時間方法 var time new date var year time.getfullyear var second time.getseconds var month time.getmonth 1 據說是程式設計...

字串練習

模擬tirm 方法 去除字串兩段的空格 思路 定義兩個變數 start end 分別從字串的兩段對字串進行逐個字元的判斷,當出現不是空格的字元時停止判斷,整個過程中保持 start end import com.ivan.util.systemutil public class practiseon...

字串練習

1,統計乙個字串中個字元的百分比 如輸入字串asdfs a 20 s 40 d 20 f 20 include include void percentage char str,int len if str str 判斷下乙個字元 int main int len 0 printf please i...