Dart – String codeUnits Property

The string property codeunits in Dart programming language returned the list of UTF-16 code of the characters of a string. It is very useful string properties to directly find UTF-16 code units.

Syntax: String.codeUnits

Returns: a list of UTF-16 code units

// main function start 

void main() {  

   

  // initialize string st 

  String st = “Computer”;  

   

  // print the UTF-16 code 

  print(st.codeUnits);  

}

Output: 

[67, 111, 109, 112, 117, 116, 101, 114]

Leave a comment

Your email address will not be published. Required fields are marked *