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 - declaring a Boolean variable in DART

void main() { 
   bool test; 
   test=12 > 5; 
   print(test); 
}

Dart Programming - String codeUnitAt Method

void main() { 
   var res = "Good Day"; 
   print("Code Unit of index 0 (G): ${res.codeUnitAt(0)}");  
} 

Dart Programming - toString Method

void main() { 
   int n = 12; 
   var res = n.toString(); 
   print("New String: ${res}");
}

Dart Programming - substring Method

void main() { 
   String str1 = "Hello World"; 
   print("New String: ${str1.substring(6)}"); 
   // from index 6 to the last index 
   print("New String: ${str1.substring(2,6)}"); 
   // from index 2 to the 6th index 
} 

Dart Programming - String split() Method

void main() { 
   String str1 = "Today, is, Thursday"; 
   print("New String: ${str1.split(',')}"); 
} 

Dart Programming - String replaceAll() Method

void main() { 
   String str1 = "Hello World"; 
   print("New String: ${str1.replaceAll('World','ALL')}"); 
} 

Dart Programming - String compareTo() Method

void main() { 
   String str1 = "A"; 
   String str2 = "A"; 
   String str3 = "B"; 
   print("str1.compareTo(str2): ${str1.compareTo(str2)}"); 
   print("str1.compareTo(str3): ${str1.compareTo(str3)}"); 
   print("str3.compareTo(str2): ${str3.compareTo(str2)}"); 
} 

Dart Programming - String trim() Method

void main() { 
   String str1 = "hello"; 
   String str2 = "hello world"; 
   String str3 = "hello"; 
   print(str1.trim()); 
   print(str2.trim()); 
   print(str3.trim()); 
} 

Dart Programming - String toUpperCase() Method

void main() { 
   String uStr = "ABC"; 
   String lStr = "hello"; 
   print(uStr.toLowerCase()); 
   print(lStr.toLowerCase()); 
} 

Dart Programming - String toLowerCase() Method

void main() { 
   String uStr = "ABC"; 
   String lStr = "hello"; 
   print(uStr.toLowerCase()); 
   print(lStr.toLowerCase()); 
}

Advertisements
Loading...

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