Home > other >  How to remove quotation marks from string Dart
How to remove quotation marks from string Dart

Time:08-24

I want to remove the double inverted comma from the string. in dart

EX : "26f8076e-8808-4f1e-9056-589bc92bfd81"

need in : 26f8076e-8808-4f1e-9056-589bc92bfd81

Thanks in advance.

CodePudding user response:

You can replace Double inverted comma OR Double quotation marks with empty as below.

 void main() {
      String id = '"26f8076e-8808-4f1e-9056-589bc92bfd81"';
      String filteredString = id.replaceAll('"', '');
      print(filteredString);
 }

CodePudding user response:

Try below code and use replaceAll method

void main() {
  String yourString = "26f8076e-8808-4f1e-9056-589bc92bfd81";
  print(yourString.replaceAll('"', '\\"'));
}

Result: 26f8076e-8808-4f1e-9056-589bc92bfd81

You can test above code on dartpad

CodePudding user response:

String x =  "26f8076e-8808-4f1e-9056-589bc92bfd81";
 x.replaceAll('"','');
  • Related