Dart 中的 codeUnitAt()函数

首页 / Dart入门教程 / Dart 中的 codeUnitAt()函数

返回给定索引的16位UTF-16 code unit。

codeUnitAt - 语法

String.codeUnitAt(int index)
  • index  -  表示字符串中字符的索引。

codeUnitAt - 返回类型

返回一个整数。

codeUnitAt - 示例

void main() { 
   var res="Good Day"; 
   print("Code Unit of index 0 (G): ${res.codeUnitAt(0)}");  
}  

它将产生以下输出-。

Code Unit of index 0 (G): 71  

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

赵成的运维体系管理课 -〔赵成〕

Java核心技术面试精讲 -〔杨晓峰〕

快速上手Kotlin开发 -〔张涛〕

用户体验设计实战课 -〔相辉〕

手机摄影 -〔@随你们去〕

高楼的性能工程实战课 -〔高楼〕

爆款文案修炼手册 -〔乐剑峰〕

郭东白的架构课 -〔郭东白〕

互联网人的数字化企业生存指南 -〔沈欣〕

好记忆不如烂笔头。留下您的足迹吧 :)