cover

Operation on String #

We can’t do mathematical operation on string because it doesn’t make any sense. We can’t divide one name from other name, we can’t find product of two name.

We can add two string which simply means addition of attaching of one string after other string.

Concat String #

main.dart
int main(){
    String first_name = "Nitish";
    String last_name = "Kumar";
    String full_name = first_name + last_name ;
    print(full_name);   // NitishKumar
}

length #

main.dart
int main(){
    String name = "ABCD";
    int len = name.length;
    print(len);   // 4
}

substring #

main.dart
int main(){
    String name = "Nitish Kumar Singh";
    String small = name.substring(3);
    String micro = name.substring(3,6);
    print(small);   // ish Kumar Singh
    print(micro);   // itish
}

toLowerCase #

main.dart
int main(){
    String name = "Nitish Kumar Singh";
    int lower = name.toLowerCase();
    print(name);   // nitish kumar singh
}

toUpperCase #

main.dart
int main(){
    String name = "Nitish Kumar Singh";
    int lower = name.toUpperCase();
    print(name);   // NITISH KUMAR SINGH
}