Removing first letter of string

closed account (jwkNwA7f)
How can I remove the first letter of a string?

Thank you!
closed account (Dy7SLyTq)
mystring.erase(mystring[0]);
Last edited on
closed account (jwkNwA7f)
Thank you, DTSCode!
1
2
3
4
5
6
7
8
9
10
#include <iostream>

using std::cout;
using std::string;

int main(){
	string s = "Random string";
	cout << s.substr(1) << '\n';
	cout << s.replace(0,1,"") << '\n';
}
Last edited on
Topic archived. No new replies allowed.