characterAtIndex:

Posted learning-materials

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了characterAtIndex:相关的知识,希望对你有一定的参考价值。

Instance Method

characterAtIndex:

Returns the character at a given UTF-16 code unit index.

  • ios 2.0+
  • macOS 10.0+
  • tvOS 9.0+
  • watchOS 2.0+
  • Foundation

Declaration

- (unichar)characterAtIndex:(NSUInteger)index;

Parameters

index

The index of the character to retrieve.

Important

Raises an NSRangeException if index lies beyond the end of the receiver.

Return Value

The character at the array position given by index.

Discussion

You should always use the rangeOfComposedCharacterSequenceAtIndex: or rangeOfComposedCharacterSequencesForRange: method to determine character boundaries, so that any surrogate pairs or character clusters are handled correctly.

See Also

Related Documentation

以上是关于characterAtIndex:的主要内容,如果未能解决你的问题,请参考以下文章

字符串与基本数据类型转换

微信小程序代码片段

VSCode自定义代码片段——CSS选择器

谷歌浏览器调试jsp 引入代码片段,如何调试代码片段中的js

片段和活动之间的核心区别是啥?哪些代码可以写成片段?

VSCode自定义代码片段——.vue文件的模板