In my C++ program, I have the string
string s = "/usr/file.gz";
Here, how to make the script to check for .gz
extention (whatever the file name is) and split it like "/usr/file"
?
c++stringsubstring
In my C++ program, I have the string
string s = "/usr/file.gz";
Here, how to make the script to check for .gz
extention (whatever the file name is) and split it like "/usr/file"
?
Best Solution
You can use erase for removing symbols:
And you can use find to find the starting position: