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

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

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

  • codePointBefore() method is used to represent the Unicode code point before the given index and array indexing starts from 0 to length() - 1.

    codePointBefore()方法用于表示给定索引和数组索引从0开始到length()-1之前的Unicode代码点。

  • codePointBefore() 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.

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

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

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

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

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

Syntax:

句法:

    public int codePointBefore(int indices)

Parameter(s):

参数:

  • int indices – represents the index of following the Unicode code point that should be retrieved.

    int index –表示应检索的Unicode代码点之后的索引。

Return value:

返回值:

The return type of this method is int, t returns the Unicode code point before the given indices.

此方法的返回类型为int ,t返回给定索引之前的Unicode代码点。

Example:

例:

// Java program to demonstrate the example
// of int codePointBefore(int indices) method of StringBuilder
public class CodePointBefore {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 codePointBefore(2) method is to return the codepoint
// at before the given index 2 i.e. it returns codepoint at
// following the given index i.e index 1
int cp = st_b.codePointBefore(2);
// Display codepoint value at before the given index 2
System.out.println("st_b.codePointBefore(2)=" + cp);
}
}

Output

输出量

st_b = Java
st_b.codePointBefore(2)=97

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

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

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

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

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

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

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

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

  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. 苹果大战FBI将加速科技圈的加密技术发展?
  2. linux7 无法连接网络,CentOS7无法连接网络怎么办
  3. 【Redis】解析Redis和Java传递数据
  4. java星座测试需求分析_java十二星座 (快来测试你是什么星座吧)
  5. 加密算法概念简介--MD5、SHA、DES、3DES、AES、RSA、ECC
  6. Intouch使用SIDirect OIServer 连接西门子PLC S7-300
  7. [20171106]配置客户端连接注意.txt
  8. Angular项目构建指南 - 不再为angular构建而犹豫不决
  9. 考研二战,入职华为,反向调剂电子科大深圳
  10. 计算机网络密码凭据,电脑无法上网时总是提示需要输入网络密码如何解决
  11. word怎么删除参考文献的横线_word2016怎么去掉引用参考文献的横线?
  12. 分库分表就能无限扩容吗
  13. 电大计算机网考怎么过,国家开放大学电大考试计算机网考题库大全(必过).doc...
  14. 向量间的线性关系(3)
  15. 免费OCR图片文字识别小工具,一键提取图片中文字,支持多语言翻译和发票识别
  16. 我奋斗18年,和你或者咖啡没有任何关系
  17. Meta宣布大裁员,超11000人!毕业前夜员工瑟瑟发抖,坐等明早的大礼包开奖!...
  18. php filter_sanitize_number_int,php – 我正确使用FILTER_VALIDATE_INT FILTER_SANITIZE_NUMBER_INT吗?...
  19. 0基础学会 守护进程(内附C语言源码)
  20. “智慧警务”:信息科技下的平安龙岗

热门文章

  1. oracle =1,oracle中的 where 1=1 和where 1 !=1
  2. 多学一招总没错吧?SpringBoot解决前后端分离的跨域问题
  3. Python 面向对象 实例方法 属性 (上)
  4. Docker原理之UnionFS
  5. 汇编中的函数调用与递归
  6. saiku+kettle整合(六)olap操作
  7. Kubernetes Master High Availability 高级实践
  8. ASP.NET Session丢失问题原因及解决方案[转]
  9. 30岁之前需要知道的10个人生底线,你知道几个?
  10. EasyUI DataGrid 中字段 formatter 格式化不起作用