1、  构造方法:

String(byte[] byte,int offset,int length);这个在上面已经用到。

2、  equalsIgnoreCase:忽略大小写的比较,上例中如果您输入的是BYE,则不会退出,因为大小写不同,但是如果使用这个方法,则会退出。

3、  indexOf(int ch);返回字符ch在字符串中首次出现的位置

4、  substring(int benginIndex);

5、  substring(int beginIndex,int endIndex);

返回字符串的子字符串,4返回从benginindex位置开始到结束的子字符串,5返回beginindex和endindex-1之间的子字符串。

基本数据类型包装类的作用是:将基本的数据类型包装成对象。因为有些方法不可以直接处理基本数据类型,只能处理对象,例如vector的add方法,参数就只能是对象。这时就需要使用他们的包装类将他们包装成对象。

 public class testInteger
{
public static void main(String[] args)
//main()的参数是string类型的数组,用来做为长,宽时,要转换成整型。
{
int w=new Integer(args[0]).intValue();
int h=Integer.parseInt(args[1]);
//int h=Integer.valueOf(args[1]).intValue();
//以上为三种将字符串转换成整形的方法。
for(int i=0;i<h;i++)
{
StringBuffer sb=new StringBuffer(); //使用stringbuffer,是因为它是可追加的。
for(int j=0;j<w;j++)
{
sb.append('*');
}
System.out.println(sb.toString()); //在打印之前,要将stringbuffer转化为string类型。
}
}
}

String类的常用成员方法的更多相关文章

  1. string类的常用功能演示

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

  2. String类的常用判断方法使用练习

    选取了一些常用的判断方法进行了使用练习,后续跟新其他方法 package StringDemo; // String类的判断方法解析 // 1:boolean equals(); // 判断字符串是否 ...

  3. String类中常用的操作

    一.获取: 1.获取字符串的长度(注意是方法,不是跟数组的属性一样的) int length(); 1 public static void getLength(){ 2 String s = &qu ...

  4. Java——String类(常用类)

    一.String类——描述字符串 常用的方法简单介绍: 1.charAt() 获取对应位置的字符 2.length() 获取字符串的长度 3.concat() 在字符串的尾部追加内容-----相当于连 ...

  5. String类中常用的方法

    @Test public void demo(){ // 以下为String中的常用的方法及注释, 最常用的注释前有**标注 String s = "abcdefg123456"; ...

  6. Calendar类介绍_获取对象的方式和Calendar类的常用成员方法

    java.util.Calendar类:日历类 Calendar类是一个抽象类,里边提供了很多操作日历字段的方法(YEAR.MONTH.DAY_OF_MONTH.HOUR ) Calendar类无法直 ...

  7. String 类的常用字符串方法

    public class Page106 { /** * 字符串练习第五章 * @param args */ public static void main(String[] args) { Stri ...

  8. String类中常用的方法(重要)

    1.字符串与字节 public String(byte[] byte); 将全部字节变成字符串 public String (byte[] byte,int offset,int length) 将部 ...

  9. 2017.12.11 String 类中常用的方法

    1.编写程序将 "jdk" 全部变为大写,并输出到屏幕,截取子串"DK" 并输出到屏幕 package demo; import java.util.Scann ...

随机推荐

  1. 浏览器开发调试工具的秘密 - Secrets of the Browser Developer Tools

    来源:GBin1.com 如果你是一个前端开发人员的话,正确的了解和使用浏览器开发工具是一个必须的技能. Secrets of the Browser Developer Tools是一个帮助大家了解 ...

  2. 前端工程化 ESlint 配置

    1.使用的标准 // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style extends ...

  3. "no talloc stackframe at ../source3/param/loadparm.c:4864, leaki

    This problem related to the samba PAM module. You have 2 solution at all. Solution 1#: Remove it( as ...

  4. centOS7 安装redis-3.2.6

    0.下载tar.gz包并解压到某个位置,然后cd进入解压后的目录(redis-3.2.6)下 1.安装 make MALLOC=libc 关于为什么这样做,参考redis-3.2.6目录下的READM ...

  5. Sphinx-安装和配置

    本例是在Linux下, 环境 CentOS6.5 + PHP5.6.8 + MySQL5.6.13 + Sphinx2.3.1-beta 到官网下载对应环境的安装包, 按照官方文档指定步骤进行安装 第 ...

  6. Codeigniter MongoDB扩展之使用Aggregate实现Sum方法

    本篇文章由:http://xinpure.com/codeigniter-mongodb-extension-using-aggregate-sum-method/ Codeigniter Mongo ...

  7. maven 动态版本 aliyun阿里云Maven仓库地址——加速你的maven构建

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  8. postman--- form-data、x-www-form-urlencoded、raw、binary分别如何设置

    转自:http://blog.csdn.net/wangjun5159/article/details/47781443 1.form-data:  就是http请求中的multipart/form- ...

  9. Postman---html中get和post的区别和使用

    get和post的区别和使用 Html中post和get区别,是不是用get的方法用post都能办到? Http定义了与服务器交互的不同方法,最基本的方法有4种,分别是GET,POST,PUT,DEL ...

  10. 面试、笔试中常用的SQL语句(数据库知识必杀)一共50个!!!

    Student(S#,Sname,Sage,Ssex) 学生表  Course(C#,Cname,T#) 课程表  SC(S#,C#,score) 成绩表  Teacher(T#,Tname) 教师表 ...