当前位置: 首页 > 文档资料 > Dart 中文教程 >

codeUnitAt()

优质
小牛编辑
123浏览
2023-12-01

返回给定索引处的16位UTF-16代码单元。

语法 (Syntax)

String.codeUnitAt(int index)

参数 (Parameter)

  • Index - 表示字符串中的字符索引。

返回值 (Return Type)

返回一个整数。

例子 (Example)

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

它将产生以下output - 。

Code Unit of index 0 (G): 71