StringBuilder类codePointAt()方法 (StringBuilder Class codePointAt() method)

  • codePointAt() method is available in java.lang package.

    codePointAt()方法在java.lang包中可用。

  • codePointAt() method is used to return the Unicode code point at the given indices and array indexing starts at 0 and ending at length () - 1.

    codePointAt()方法用于返回给定索引处的Unicode代码点,数组索引从0开始,以length()-1结尾。

  • codePointAt() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    codePointAt()方法是一种非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • codePointAt() method may throw an exception at the time of assigning index.

    分配索引时, codePointAt()方法可能会引发异常。

    IndexOutOfBoundsException - This exception may throw when the given argument value is greater than the length or denotes negative value.

    IndexOutOfBoundsException-当给定参数值大于长度或表示负值时,可能引发此异常。

Syntax:

句法:

    public int codePointAt(int indices);

Parameter(s):

参数:

  • int indices – represents the index to the referred character values.

    int index –表示引用字符值的索引。

Return value:

返回值:

The return type of this method is int, it returns the Unicode code point of the char at the given indices.

此方法的返回类型为int ,它返回给定索引处char的Unicode代码点。

Example:

例:

// Java program to demonstrate the example
// of int codePointAt(int indices) method of StringBuilder
public class CodePointAt {public static void main(String[] args) {// Creating an StringBuilder object
StringBuilder st_b = new StringBuilder("Java");
System.out.println("st_b = " + st_b);
// By using codePointAt(2) method is to return the codepoint
// at the given index 2
int cp = st_b.codePointAt(2);
// Display codepoint value at the given index 2
System.out.println("st_b.codePointAt(2)=" + cp);
}
}

Output

输出量

st_b = Java
st_b.codePointAt(2)=118

翻译自: https://www.includehelp.com/java/stringbuilder-codepointat-method-with-example.aspx

Java StringBuilder codePointAt()方法与示例相关推荐

  1. Java IOUtils.copy方法代码示例(亲测)

    本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...

  2. setlength java_Java StringBuilder setLength()方法与示例

    StringBuilder类setLength()方法setLength()方法在java.lang包中可用. setLength()方法用于在将字符序列替换为新字符序列时设置字符序列的长度,因此该序 ...

  3. java codepointbefore_Java StringBuilder codePointBefore()方法与示例

    StringBuilder类codePointBefore()方法codePointBefore()方法在java.lang包中可用. codePointBefore()方法用于表示给定索引和数组索引 ...

  4. java user directory,Java ProcessBuilder directory()方法与示例

    语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...

  5. Java序列化魔术方法及其示例使用

    在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...

  6. catalog java,Java Connection getCatalog()方法与示例

    通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...

  7. filepermission java,Java FilePermission getActions()方法与示例

    FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...

  8. java方法参数Bundle,Java ResourceBundle keySet()方法及示例

    ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...

  9. java exec waitfor,Java Process waitFor()方法与示例

    流程类waitFor()方法在java.lang包中提供了waitFor()方法. waitFor()方法用于使当前正在运行的线程在需要时等待,直到由该Process对象表示的进程完成其终止为止. 当 ...

最新文章

  1. Chemistry.AI | 基于图卷积神经网络(GCN)预测分子性质
  2. hdu5248序列变换(二分+贪心)基础题
  3. 可作为工质状态参数的是_制冷工质的热力状态参数都有哪些?
  4. Windows Server 2008之三设置TCP/IP
  5. oracle 意外事件,Oracle数据库REDO损坏ora-00333修复手札
  6. 【Flink】报错 KryoException ConcurrentModificationException StackOverflowError
  7. c语言如何制作多线程序,c语言中如何创建多线程。最好有一个例子,谢谢!!...
  8. lisp单个文件的编译
  9. Linux(Ubuntu)菜单栏(工具栏)隐藏了,怎么显示出来
  10. Windows下强制删除文件或文件夹
  11. 单片机实验(六)控制共阴极数码管1-9显示
  12. docker 离线安装 mysql_Linux下离线安装Docker
  13. unity通过鼠标滑轮控制物体大小
  14. C++PrimePlus第5章编程练习答案及运行结果
  15. iapp获取桌面壁纸
  16. 微信怎样查绑定的服务器地址,你的微信绑定了哪些网站和应用?这个方法可以一键查看......
  17. iOS 14.2 内置原生壁纸,安排上吧!
  18. 八股文-- 2022.08.31
  19. 卓别林论Scrum价值观:当我真正开始爱自己
  20. java简单的记事本程序_如何用JAVA编写简单的记事本程序?

热门文章

  1. 关于React-native的介绍以及环境搭建
  2. EasyUI加zTree使用解析 easyui修改操作的表单回显方法 验证框提交表单前验证 datagrid的load方法
  3. webstorm中vue项目--运行配制
  4. 如何在一个页面添加多个不同的kindeditor编辑器
  5. 酷炫,用Html5/CSS实现文字阴影
  6. background使用
  7. js笔记(三)ES5、ES5新增的数组的方法、字符串的方法、字符编码、对象的序列化和反序列化、bind
  8. HashSet源码分析:JDK源码系列
  9. ASP.NET获取客户端、服务器端基础信息
  10. luogu P1880 [NOI1995]石子合并