cube70
1
Godot Version
v4.2.1.stable.mono.official [b09f793f5]
Question
I want to remove the last character of a string. Currently i’m doing
newText = newText.Remove(newText.Length - 1);
But of course it doesn’t work. What is the porper way of removing characters?
newText = newText.Erase(-1);
?
are you sure? because GDScript’s has Erase method, now i realized it needs to be positive or zero for the first parameter
so it should be looking like:
newText = newText.Erase(newText.Length - 1);
cube70
5
What version of Godot are you using? Looking online it seems that erase was removed in 4.0
It gives me an error if I put it in.
4.2.1 mono
funny enough your .Remove works here
igat
7
Hello. Remove()
method should be work becouse it is C# method.
Can you share more code?
yeah like igat said
or use Substring()
newText= newText.Substring(0,newText.Length -1);
1 Like