Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Dart Programming - String Property length

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

Dart Programming - String Property isEmpty

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

Dart Programming - String Property codeUnits

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

Dart Programming - String Interpolation

void main() { 
   int n=1+1; 
   String str1 = "The sum of 1 and 1 is ${n}"; 
   print(str1); 
   String str2 = "The sum of 2 and 2 is ${2+2}"; 
   print(str2); 
}

Dart Programming - String

void main() { 
   String str1 = 'this is a single line string'; 
   String str2 = "this is a single line string"; 
   String str3 = '''this is a multiline line string'''; 
   String str4 = """this is a multiline line string"""; 
   print(str1);
   print(str2); 
   print(str3); 
   print(str4); 
}

Dart Programming - Truncate Method

void main() { 
   double n1 = 2.123; 
   var value = n1.truncate(); 
   print("The truncated value of 2.123 = ${value}"); 
} 

Dart Programming - toString Method

void main() {   
   int n1 = 2;   
   var value = n1.toString();   
   print( value is String ); 
} 

Dart Programming - toInt Method

void main() { 
   double n1 = 2.0; 
   var value = n1.toInt(); 
   print("Output = ${value}"); 
} 

Dart Programming - toDouble Method

void main() { 
   int n1 = 2; 
   var value = n1.toDouble(); 
   print("Output = ${value}"); 
} 

Dart Programming - round Method

void main() { 
   double n1 = 12.023; 
   double n2 = 12.89; 
   var value = n1.round(); 
   print( value ); 
   value = n2.round(); 
   print( value ); 
} 

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.