Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Remove special characters from string

var outString = sourceString.replace(/[`~!@#$%^&*()_|+-=?;:'",.<>{}[]/]/gi, '');
Comment

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;
}
Comment

PREVIOUS NEXT
Code Example
Java :: print list in java 
Java :: android round double to 2 decimal 
Java :: random.choice in java 
Java :: spigot how to make an inventory 
Java :: android start service on boot 
Java :: java print treemap 
Java :: How to implement a Trie data structures in Java? 
Java :: how to stop screen rotation in android code 
Java :: @SpringBootApplication 
Java :: get drawable with string android java 
Java :: java stream sorted reverse 
Java :: JFrame labels 
Java :: get epoch time in java 
Java :: android glide dependencies 
Java :: java integer to binary string 
Java :: set icon to fab programmatically in android studio 
Java :: android plain text remove underline 
Java :: how to print in java 
Java :: How to find the fibonacci of an integer value iteratively in Java? 
Java :: list of longs to comma separeated string java 
Java :: error:03000086 
Java :: java product 1 to n 
Java :: similarity between abstract class and interface java 
Java :: android how to start a new activity on button click 
Java :: how to check if page in webview or not in android studio 
Java :: solucion var java 
Java :: how to add animation to nivation component android 
Java :: how to use ? in java without using if 
Java :: java array copy 
Java :: system.out.write in java example 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =