Dart String.codeUnitAt()方法返回给定索引处的16位UTF-16代码单元。
语法
String.codeUnitAt(int index)
参数
- index- 表示字符串中的字符索引。
返回值
- 返回一个数字值。
示例
void main() { 
   var res = "Good Day"; 
   print("Code Unit of index 0 (G): ${res.codeUnitAt(0)}");  
}
执行上面示例代码,得到以下结果 -
Code Unit of index 0 (G): 71
