القائمة الرئيسية

الصفحات

 Dart String Properties


The properties listed in the following table are all read-only.

Sr.NoProperty & Description
1codeUnits

Returns an unmodifiable list of the UTF-16 code units of this string.

2isEmpty

Returns true if this string is empty.

3Length

Returns the length of the string including space, tab and newline characters.

String Property codeUnits

Returns a list of the UTF-16 code units of a given string.

Syntax

String.codeUnits

Example


void main() { 
   String str = "Hello"; 
   print(str.codeUnits); 
} 

It will produce the following output −.

[72, 101, 108, 108, 111] 

String Property isEmpty

Returns true if the string is empty; else returns false.

Syntax

String.isEmpty

Example


void main() { 
   String str = "Hello"; 
   print(str.isEmpty); 
} 

It will produce the following output −.

False 

String Property length

Returns the length of the string including space, tab and newline characters.

Syntax

String.length

Example


void main() { 
   String str = "Hello All"; 
   print("The length of the string is: ${str.length}"); 
} 

It will produce the following output −.

The length of the string is: 9

هل اعجبك الموضوع :

تعليقات