Home > Enterprise >  How to check in a string after the whitespace any character is there or not in flutter?
How to check in a string after the whitespace any character is there or not in flutter?

Time:11-12

I need to check a string if any character is present after the whitespace. If not present i need to trim and remove the last whitespace.

I tied using trim() method but in the case of that it will trim the remaining part is any character is present after the whitespace.

CodePudding user response:

String text="name is n";
  print(text.split(" ").last.isEmpty);

if the last value is false then there are character in last part and do any operation you want i hope it help.

  • Related