1、public char charAt(int index)

 public class Test{
public static void main(String args[]){
String s="hello world!";//返回这个字符串的指定索引处的char值
char c0=s.charAt(0);//第一个char值的索引为0.
//char c1=s.charAt(20);
//IndexOutOfBoundsException抛出异常,index参数为负或不小于该字符串的长度.
System.out.println(c0);
}
}

2、public int codePointAt(int index)

 public class Test{
public static void main(String args[]){
String s="hello world!";//返回指定索引处的字符(Unicode代码点)
int i=s.codePointAt(0);//其范围从0到length()-1
System.out.println(i);
}
}

String All Methods的更多相关文章

  1. Java String class methods

    Java String class methods 现在不推荐使用 StringTokenizer 类.建议使用 String 类的 split()方法或 regex(正则表达式). String c ...

  2. JavaScript string repeat methods All In One

    JavaScript string repeat methods All In One There are many ways in the ES-Next ways repeat ES2015 / ...

  3. 如何将List<string>转化为string

    Convert List, string. A List can be converted to a string. This is possible with the ToArray method ...

  4. Java String Class Example--reference

    reference:http://examples.javacodegeeks.com/core-java/lang/string/java-string-class-example/ 1. Intr ...

  5. STL string 模拟

    下面的代码来自c++ primer plus第5版第12章,书中代码写的非常好: // string1.h -- fixed and augmented string class definition ...

  6. Java String, StringBuffer和StringBuilder实例

    1- 分层继承2- 可变和不可变的概念3- String3.1- 字符串是一个非常特殊的类3.2- String 字面值 vs. String对象3.3- String的方法3.3.1- length ...

  7. java基础源码 (1)--String类

    这个是String类上面的注释,我用谷歌翻译翻译的,虽然有点语法上的问题,但是大概都可以翻译出来 /** * The {@code String} class represents character ...

  8. Java String 综述(上篇)

    摘要: Java 中的 String类 是我们日常开发中使用最为频繁的一个类,但要想真正掌握的这个类却不是一件容易的事情.笔者为了还原String类的真实全貌,先分为上.下两篇博文来综述Java中的S ...

  9. Hacker Rank: Two Strings - thinking in C# 15+ ways

    March 18, 2016 Problem statement: https://www.hackerrank.com/challenges/two-strings/submissions/code ...

随机推荐

  1. 解决:IntelliJ IDEA 编译错误,提示 Compilation failed: internal java compiler error

    原因可能是项目指定的JDK与当前环境JDK不符合,解决办法:File->Setting->Compiler->Java Compiler, 在相应的module中选择合适的JDK版本 ...

  2. mysql免安装方法

    在官网上下载了个mysql-installer-community-5.6.27.0.msi,需要安装环境,检测未通过,很麻烦.之后网上查了资料之后直接下载了个压缩包mysql-5.6.27-winx ...

  3. CSS生成内容

    在Web中插入内容,在CSS2.1时代依靠的是JavaScript来实现.但进入CSS3进代之后我们可以通过CSS3的伪类“:before”,“:after”和CSS3的伪元素“::before”.“ ...

  4. 纯html、css3、js的时钟

    之前在网上看了一些使用js写的时钟,但感觉实现的方法有点麻烦,所以就自己重新写了一个例子,样子有点丑,但方法比较简单,大家就凑合看吧 其中采用的主要方法是原生js里面的Data(时期)对象,以及它的. ...

  5. 我的第二个FluentNHibernate例子with Knockout

    在上一篇我的第一个FluentNHibernate例子的基础上,我们用上knockoutjs 1用nuget添加knockoutjs包 2用nuget添加json.net包 3..在Index.csh ...

  6. java布局学习 (三)

    前文已经讲了常用的4个布局了,今天再介绍最后的三个布局: 5.CardLayout 6.BoxLayout 7.空白布局null (五)CardLayout   纸牌布局 首先这种布局不是二维布局,而 ...

  7. 用node-inspector调试Node.js(转自NOANYLOVE'S BLOG)

    原文地址:http://www.noanylove.com/2011/12/node-the-inspector-debugging-node-js/ 用node-inspector调试Node.js ...

  8. 第一次写这么长的js

    是公司一个项目,要求显示不同的sku,然后根据sku组合显示不同的价格区间,根据填写的数量落在哪个价格区间,然后进行计算.实际截图如下: 前端JS如下: <script type="t ...

  9. AngularJs的UI组件ui-Bootstrap

    http://www.cnblogs.com/pilixiami/p/5597634.html

  10. dev GridView常用属性,事件

    一.属性 1.GridControl属性 //允许拖拽行 gridControl1.AllowDrop = true; 2.GridView属性 //不可编辑 gridView1.OptionsBeh ...