Java StringBuilder codePointAt()方法与示例

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/379489.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

用户虚拟地址转化成物理地址,物理地址转换成内核虚拟地址,内核虚拟地址转换成物理地址,虚拟地址和对应页的关系

文章目录1. 用户虚拟地址转换成物理地址2. 内核虚拟地址转换成物理地址3. 物理地址转换成内核虚拟地址4 内核虚拟地址和对应页5 根据进程号获取进程描述符1. 用户虚拟地址转换成物理地址 static void get_pgtable_macro(void) {printk("PAGE_OFFSET 0x%lx\n", PAGE…

简单三层架构(登录)

1,首先导包 dao //获取数据String username request.getParameter("username");String password request.getParameter("password");//传递到Service层UserService service new UserService();//这里的UserService 需要创建到service包下Use…

通过隐藏option实现select的联动效果

开始的时候需求是根据一定条件隐藏一部分<option>标签&#xff0c;类似联动效果&#xff0c;但是目前的html规范并没有为<option>提供隐藏的效果&#xff0c;因此常用的设置display或者visibility无效。网上大部分解决方案是删除<option>节点或<option>…

Java SimpleTimeZone setEndRule()方法与示例

SimpleTimeZone类setEndRule()方法 (SimpleTimeZone Class setEndRule() method) Syntax: 句法&#xff1a; public void setEndRule(int en_mm, int en_dd, int en_time);public void setEndRule(int en_mm, int en_dd, int en_dow, int en_time);public void setEndRule(int…

Linux设备驱动开发--- DMA

文章目录1 设置DMA映射缓存一致性和DMADMA映射一致映射流式DMA映射2 完成的概念3 DMA引擎API分配DMA从通道设置从设备和控制器指定参数获取事务描述符提交事务发布待处理DMA请求并等待回调通知4 程序单缓冲区映射分散聚集映射DMA是计算机系统的一项功能&#xff0c;它允许设备在…

类加载器

一、类加载器 1&#xff0c;什么是类加载器&#xff1f; 类加载器就是用来加载字节码文件 2&#xff0c;类加载器的种类有哪些&#xff1f; 1&#xff09;BootStrap&#xff1a;引导类加载器&#xff1a;加载都是最基础的文件 2&#xff09;ExtClassLoader&#xff1a;扩展类加…

一个用java读取XML文件的简单方法(转)

XML文件 book.xml <book> <person> <first>Kiran</first> <last>Pai</last> <age>22</age> </person> <person> <first>Bill</first> <last>Gates</last> <age>46</age&g…

Java ObjectStreamField getName()方法与示例

ObjectStreamField类的getName()方法 (ObjectStreamField Class getName() method) getName() method is available in java.io package. getName()方法在java.io包中可用。 getName() method is used to get the name of this ObjectStreamField field. getName()方法用于获取…

【css】CSS中折叠margin的问题

为什么要翻译这篇说明&#xff1f;css2本有人已翻译过&#xff0c;但看一下&#xff0c;很粗糙&#xff08;不是说自己就怎么怎么样啊&#xff0c;翻译者真的是很值得敬佩的&#xff01;&#xff09;&#xff0c;近来跟css与xhtml接触得越来越多&#xff0c;但接触得越多&#…

算法---链表

文章目录反转链表合并两个有序链表删除重复元素反转链表 反转链表包括两种&#xff0c;反转全部元素或者反转部分元素。在这里&#xff0c;我们约定&#xff1a;数据元素类型是struct LinkNode&#xff0c;要反转链表的第一个节点是head&#xff0c;head的前面一个节点是pre&a…

SSM

二、环境设置&#xff08;MyEclipse&#xff09; 1&#xff0c;字体设置 window–>Preference->General->Appearance->Colors and Fonts->Basic Text->Font 2&#xff0c;workspace字符集设置 window–>Preference->General->Appearance->W…

IOS NSArray,NSDictionary

小结&#xff1a; NSArray有序的集合&#xff1b; NSDictionary无序的集合&#xff0c;可排序&#xff1b; 增删改查 ------NSArray----------- create : 1)NSArray *array [NSArray arrayWithObjects:"Henry","Jones", "Susan", "Smith&q…

Java PropertyPermission equals()方法与示例

PropertyPermission类equals()方法 (PropertyPermission Class equals() method) equals() method is available in java.util package. equals()方法在java.util包中可用。 equals() method is used to check whether this object and the given object (ob) are equal or not…

c#配合oracle快速导入excel方法--原创(6万条记录5分钟左右)

原理&#xff1a;用c#采用读取Excel数据源方式将数据读入c#的datatable,循环datatable,将datatable中的数据用stringbuilder拼成insert into (字段名) valus (值);每5条插入一个符号&#xff08;作用是将sql字符串限制在4000字符以内&#xff09;&#xff0c;然后将拼成的字符串…

English最俗语法大全

一、先分析两个长难句 1,It is a truth universally acknowledged that a single man in possession of a good fortune must be in want of a wife. 人们公认这样一个事实&#xff0c;一个有钱的单身男人一定想要娶一个妻子。 in want of want 想要 university widely 广泛的…

tfs 内网和外网切换的方法。

C:\Windows\System32\drivers\etc的hosts文件配置一个123.67.128.109 geo-dept-3转载于:https://www.cnblogs.com/lwflt/archive/2012/07/23/2604731.html

observable_Java Observable countObservers()方法与示例

observable可观察的类countObservers()方法 (Observable Class countObservers() method) countObservers() method is available in java.util package. countObservers()方法在java.util包中可用。 countObservers() method is used to count the number of observers exists…

设计模式--Strategy 策略模式

所谓策略模式(Strategy Pattern)&#xff0c;就是将策略 (算法) 封装为一个对象&#xff0c;易于相互替换&#xff0c;如同 USB 设备一样可即插即用&#xff1b;如果将策略、具体的算法和行为&#xff0c;编码在某个类或客户程序内部&#xff0c;将导至事后的修改和扩展不易。 …

HDU-1518 Square dfs+剪枝

该题问给定的棍子能否组成一个正方形。首先我们要判定是否总长度是4的倍数&#xff0c;然后再决定是否存在某条边大于组合边长。 搜索的过程中也是可以进行剪枝了。 首先将边排序&#xff0c;我们可以假定所有的组合边由大小递减的边组成&#xff0c;那么我们在搜索的时候就不用…

英语思维黄金法则

一、谓语单一原则 英文的句子当中&#xff0c;有且只有一套谓语结构。 要想使用多个谓语&#xff0c;有以下三种方法&#xff1a; 1&#xff0c;利用连词将不同谓语并列起来 2&#xff0c;把其中的一些动词给降级&#xff08;v-ing v-ed 非谓语动词&#xff09; 3&#xff0c;…