I need to count the number of CR or LF or LF + CR in a String. I'm doing this:
String content = "\r dasdsad \r asdasdasd \r";
int count = content.allMatches('\r').length;
print('count: $count');
But I get always zero as count value.
You have to inverse '\r'
and content
:
String content = "\r dasdsad \r asdasdasd \r";
int count = '\r'.allMatches(content).length;
print('count: $count');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With