/*
* 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[] ch=s.toCharArray();
for(int x=0;x<ch.length;x++)
{
System.out.println(ch[x]);
}
System.out.println("------");
System.out.println("HelloMOTO".toLowerCase());
System.out.println("babycome".toUpperCase());
} }

String类的转换功能的更多相关文章

  1. Java基础知识强化34:String类之String类的转换功能

    1. String类的转换功能 String[] split(String regex)//将字符串变成字符串数组(字符串切割) byte[] getBytes()//将字符串变成字节数组 char[ ...

  2. java11-5 String类的转换功能

    String的转换功能: byte[] getBytes():把字符串转换为字节数组. char[] toCharArray():把字符串转换为字符数组. static String valueOf( ...

  3. String的用法——转换功能

    package cn.itcast_05; /* String类的转换功能: byte[] getByte():把字符串转换成字节数组 复习: public String(byte[] bytes): ...

  4. String 类的其他功能

    12.01_常见对象(Scanner的概述和方法介绍)(掌握) A:Scanner的概述 B:Scanner的构造方法 Scanner(InputStream source) System.in C: ...

  5. java11-6 String类的其它功能

    String类的其他功能: 替换功能: String replace(char old,char new) String replace(String old,String new) 去除字符串两空格 ...

  6. java11-3 String类的获取功能

    String类的获取功能 int length():获取字符串的长度. char charAt(int index):获取指定索引位置的字符 int indexOf(int ch):返回指定字符在此字 ...

  7. Java基础知识强化33:String类之String类的获取功能

    1. String类的获取功能 int length() // 获取字符串中字符的个数(长度) char charAt(int index)//根据位置获取字符 int indexOf(int ch) ...

  8. Java基础知识强化32:String类之String类的判断功能

    1. String类的判断功能: boolean equals (Object obj ) boolean equalsIgnoreCase (String str ) boolean contain ...

  9. string类的常用功能演示

    这个程序可用随着我对string的用法的增多而有调整. /* 功能说明: string类的常用功能演示. 实现方式: 主要是演示string的常用函数的用法和它与字符数组的区别与联系 限制条件或者存在 ...

随机推荐

  1. C++中正确使用PRId64 (转载)

    转自:http://blog.csdn.net/win_lin/article/details/7912693 例子参考高性能流媒体服务器SRS:https://github.com/winlinvi ...

  2. bzoj 1642: [Usaco2007 Nov]Milking Time 挤奶时间【dp】

    这不就是个n方dp吗--看了眼洛谷题解简直神仙打架 我全程没用到n-- 把休息时间并入产奶时间,注意"结束时间不挤奶",所以ei=ei+r-1,注意这个-1! 然后按r排序,设f[ ...

  3. Juicer.js模板引擎问题

    由于jsp中的EL表达式语法和jquery.tmpl十分类似,,所以单纯的使用${name},数据是渲染不上tmpl的. SO.. 要加上转义: ${'${'}amount} 或者 \${amount ...

  4. KMP POJ 2752 Seek the Name, Seek the Fame

    题目传送门 /* 题意:求出一个串的前缀与后缀相同的字串的长度 KMP:nex[]就有这样的性质,倒过来输出就行了 */ /************************************** ...

  5. 二分搜索 POJ 3258 River Hopscotch

    题目传送门 /* 二分:搜索距离,判断时距离小于d的石头拿掉 */ #include <cstdio> #include <algorithm> #include <cs ...

  6. DHTML_____如何编写事件处理程序

    <html> <head> <meta charset="utf-8"> <title>如何编写事件处理程序</title&g ...

  7. C#模拟百度登录并到指定网站评论回帖(三)

    上次说到怎么获取BAIDUID,这个相信很多人都能够拿到就不多说了,今天一连说两个,获取token和raskey 2.利用以上获得的cookie直接访问页面 https://passport.baid ...

  8. 读《实战 GUI 产品的自动化测试》之:第二步,构建利于维护的自动化测试系统

    转载自:http://www.ibm.com/developerworks/cn/rational/r-cn-guiautotesting2/ 基石——IBM 框架简介 Rational Functi ...

  9. 用antlr4来实现《按编译原理的思路设计的一个计算器》中的计算器

    上次在公司内部讲<词法分析——使用正则文法>是一次失败的尝试——上午有十几个人在场,下午就只来了四个听众. 本来我还在构思如何来讲“语法分析”的知识呢,但现在看来已不太可能. 这个课程没有 ...

  10. Microsoft SQL Server学习(五)--操作符聚合函数

    算术运算符 逻辑运算符 比较运算符 聚合函数 算术运算符(+ - * / ) select score*2 as 成绩翻倍 from class_A update class_A set score= ...