Dart 中的 codeUnitAt()函数

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

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

codeUnitAt - 语法

String.codeUnitAt(int 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  

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

技术教程推荐

Flutter核心技术与实战 -〔陈航〕

说透中台 -〔王健〕

Java业务开发常见错误100例 -〔朱晔〕

Service Mesh实战 -〔马若飞〕

软件设计之美 -〔郑晔〕

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

Python自动化办公实战课 -〔尹会生〕

B端体验设计入门课 -〔林远宏(汤圆)〕

LangChain 实战课 -〔黄佳〕

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