Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to remove special characters from a string

#include <iostream>
#include <string>
#include <algorithm>
 
int main()
{
    std::string s = "#Hello #World!!";
    std::string chars = "#!";
 
    for (char c: chars) {
        s.erase(std::remove(s.begin(), s.end(), c), s.end());
    }
 
    std::cout << s;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #special #characters #string
ADD COMMENT
Topic
Name
7+5 =