+ 2
How to delete the last character from the string ?
How to delete the last character (not /0) from the string ? if anyone can help, please answer it...
7 Réponses
+ 1
s.substring(0, s.length() - 1)
https://code.sololearn.com/c0s366Rz5A1V/?ref=app
+ 4
https://code.sololearn.com/cJmsrBzQXK5S/?ref=app
AdrenoLegend You can see code😎
+ 3
The simplest way to do it in C++ is using pop_back(), like for vector:
#include <string>
std::string s = "text";
s.pop_back();
std::cout << s;
// tex
+ 2
You haven’t mentioned which language you want help in; this is how to do this in python:
a='hello'
a=a[:-1]
print(a) # returns ‘hell’
+ 2
In that case, I can't help you, sorry. Try tagging your question with the language names and you may get a more prompt and better response.
+ 1
if i want it in c++ and java , then ?
0
Tind Did you learn all here? or from the internet, university, etc....? 😊