Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You could add more #12

Closed
ChisAdrian opened this issue Nov 12, 2023 · 1 comment
Closed

You could add more #12

ChisAdrian opened this issue Nov 12, 2023 · 1 comment

Comments

@ChisAdrian
Copy link

before/after Last/First Cha
Example
std::string beforeLastChar(const std::string& str, char target) {
size_t lastPos = str.find_last_of(target);

if (lastPos != std::string::npos) {
    return str.substr(0, lastPos);
}

return str; // Return the whole string if the character is not found

}

@tgalaj
Copy link
Owner

tgalaj commented Nov 12, 2023

Thank you for your suggestion. Feel free to make a pull request out of it and please link this issue to the PR.

@tgalaj tgalaj closed this as completed Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants