Answers for "remove special characters from string from starting and at the end"

0

Remove special characters from string

var outString = sourceString.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '');
Posted by: Guest on May-10-2021
0

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;
}
Posted by: Guest on March-09-2022

Code answers related to "remove special characters from string from starting and at the end"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language