Reputation: 45
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.
Upvotes: 1
Views: 4048
Reputation: 1
void removeLastCharacter() {
String str = "Something."; // input : "Something."
String result = str.replaceRange(res.split("").length - 1, null, "");
print(result); // output: "Something"
}
Upvotes: 0
Reputation: 3460
void removeLastString() {
String str = "Something";
String result = str.substring(0, str.length - 1);
print(result);
}
Upvotes: 9