This is a draft cheat sheet. It is a work in progress and is not finished yet.
Syntax
String str1 = 'this is a single line string';
String str2 = "this is a single line string";
String str3 = '''this is a multi
line line string''';
String str4 = """this is a multiline line string""";
|
codeunits
String.codeUnits
void main() {
String str = "Hello";
print(str.codeUnits);
}
|
|
|
String Interpolation(concatenation)
String str1 = "hello";
String str2 = "world";
String res = str1+str2;
|
isempty
String.isEmpty
Returns true if the string is empty; else returns false.
|
length
String.length
void main() {
String str = "Hello All";
print("The length of the string is: ${str.length}");
}
|
The length of the string is: 9
|
|
interpolate the value in strings
${exp1+exp2} or any other operator */-+% ~/
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);
}
|
|