Transformation functionality for the String class
程序员文章站
2024-01-11 09:08:16
数组里面的长度是属性。String类里面的长度是方法。 ......
string类的转换功能: package com.itheima_05; /* * string类的转换功能: * char[] tochararray():把字符串转换为字符数组 * string tolowercase():把字符串转换为小写字符串 * string touppercase():把字符串转换为大写字符串 * * 字符串的遍历: * a:length()加上charat() * b:把字符串转换为字符数组,然后遍历数组 */ public class stringdemo { public static void main(string[] args) { //创建字符串对象 string s = "abcde"; //char[] tochararray():把字符串转换为字符数组 char[] chs = s.tochararray(); for(int x=0; x<chs.length; x++) { system.out.println(chs[x]); } system.out.println("-----------"); //string tolowercase():把字符串转换为小写字符串 system.out.println("helloworld".tolowercase()); //string touppercase():把字符串转换为大写字符串 system.out.println("helloworld".touppercase()); } }
数组里面的长度是属性。string类里面的长度是方法。
推荐阅读
-
Transformation functionality for the String class
-
[HOOLOO] zizaco/entrust 5.2.x-dev Class name must be a valid object or a string,hooloozizaco
-
谈谈fastjson反序列方法JSON.parseObject(String text, Class
clazz)--来源于生产实践 -
Google App Engine (Java + String + Velocity)数据访问调试,出现错误 Cannot find class [javax
-
There is no getter for property named ‘name‘ in ‘class java.lang.String‘
-
There is no getter for property named ‘name‘ in ‘class java.lang.String
-
Mybatis There is no getter for property named 'xxxx' in 'class java.lang.String'
-
String class fetch functionality
-
Codeforces Round #659 (Div. 2) C、String Transformation 1(思维+set)
-
谈谈fastjson反序列方法JSON.parseObject(String text, Class
clazz)--来源于生产实践