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  
dart_programming_string.htm
廣告
© . All rights reserved.