tested this how to remove brackets character in string (java) but it doens't worked in Dart. Any tipps to remove ( ) in a String?
My Code:
String num = (85);
num.replaceAll("\\p{P}", "");
Result should be: 85
tested this how to remove brackets character in string (java) but it doens't worked in Dart. Any tipps to remove ( ) in a String?
My Code:
String num = (85);
num.replaceAll("\\p{P}", "");
Result should be: 85
You need to use a compiled RegExp
object with unicode: true
argument:
String num = "(85)";
print(num.replaceAll(new RegExp(r"\p{P}", unicode: true), ""));
This outputs 85
as \p{P}
is now treated as a punctuation proper matching Unicode property class regex.