-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexampleString.dart
70 lines (51 loc) · 2 KB
/
exampleString.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
void main() {
String name = "kishorkc@gmail.com";
//use for comparing
String compareOne = "Flutter";
String compareTwo = "Dart";
String compareThree = "Flutter";
print(name); // print the name
print(name.length); // count the length of name
print(name.isEmpty); // check the name isEmpty
print(name.isNotEmpty); // check the name isNotEmpty
print(name.runtimeType); // give the name of the runtimeType
print(name.runes); // show the runes of name
print(name.codeUnitAt(5)); // check the codeUnitAt through index of runes
print(name.contains("kishor")); // check the name is Kishor or not
// check the name is contains with the give value or not
if (name.contains("@gmail.com")) {
print("It is present");
} else {
print("It is nt present");
}
//startsWith - the first word of name is a or not
print(name.startsWith("a")); // check if startsWith 'a' or not
//check the startsWith 'a' or not
if (name.startsWith("a")) {
print("It is startsWith with a");
} else {
print("It is not startsWith with a");
}
print(name.endsWith("m")); // check if endWith 'M' or not
//check the endsWith 'M' or not
if (name.endsWith("m")) {
print("It is end with m");
} else {
print("It is not end with m");
}
// comparing one to another
// while comparing if it return 0 means It is equal,
// if it return 1 means first string is greater than second
// if it return -1 means first string is smaller than second
print(compareOne.compareTo(compareTwo));
print(compareOne.compareTo(compareThree));
print(compareTwo.compareTo(compareThree));
print(name.substring(0)); // give all the name value
print(name.substring(0, 1)); // give the first word of the name
print(name.substring(0, 3)); // give the first word to third word of the name
print(name.split("@")); // split the name
var na = name.split('');
print(na); //split all the name
print(name.toLowerCase()); // make name in the Lowercase
print(name.toUpperCase()); // make name in the Uppercase
}