Search code examples
flutterdartbackspace

How to delete characters from last in a in string in dart?


I want to remove a character from a string say String A = "Something" Here, I want to make a function that returns "Somethin". Please Help.


Solution

  • void removeLastString() {
      String str = "Something";
      String result = str.substring(0, str.length - 1);
      print(result);
    }