tnfh.net
当前位置:首页 >> jAvA大写转小写 >>

jAvA大写转小写

public static void main(String[] args) { String str = "QAZWSXEDC"; String shuchu = ""; char[] arr = str.toCharArray(); for(int i = 0; i < arr.length; i++){ if(arr[i] % 2 == 0){ shuchu += arr[i]+"";} } System.out.println(shuchu....

toLowerCase(); //字符串转成小写 toUpperCase(); //字符串转成大写 String str = "abcABC"; String a = str.toLowerCase(); String b = str.toUpperCase(); System.out.println("a:"+a +"b:"+b); 输出结果a:abcabc b:ABCABC

1 大写转小写 String str = "ABC"; System.out.println(str.toLowerCase()); 2 小写转大写 String str = "abc"; System.out.println(str.toUpperCase());

//不需要弄那么麻烦 这样就行了 public static void main(String[] args) { String s=AHn9&nGJMm; for(int i=0;i

//把一个字符串中的大写转为小写,小写转换为大写:思路1 public static String exChange(String str){ StringBuffer sb = new StringBuffer(); if(str!=null){ for(int i=0;i

public static void main(String[] args) { //字符串,输入你自己写 String s="aDEfG"; //转换为CHAR数组 char[] cs=s.toCharArray(); //倒着处理 for(int i=cs.length-1;i>=0;i--){ //小写转大写 if(cs[i]>='a'&&cs[i]='A'&&cs[i]

public class CharTest { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("请输入字母:"); char c = in.next().charAt(0); if (c >= 'A' && c = 'a' && c

import java.util.*; public class A { public static void main(String[] args) { Scanner s=new Scanner(System.in); System.out.println("请输入一个字母:"); String str=s.nextLine(); char c=str.charAt(0); char ch=Character.isUpperCase...

public class StringCaseShift { public static String shift(String str) { int size = str.length(); char[] chs = str.toCharArray(); for (int i = 0; i < size; i++) { if (chs[i] = 'A') { chs[i] = (char) (chs[i] + 32); } else if (chs...

网站首页 | 网站地图
All rights reserved Powered by www.tnfh.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com