Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Remove special characters from string

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

Remove special characters

function removeSpecialChar($string) 
		{
			$string = strtolower($string);
			$string = preg_replace('/[^da-z ]/i', '', $string);// Removes special chars.
			$string = str_replace(' ', '-', $string); // Replaces all spaces with underscore.
			return strtolower($string);
		}
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
Javascript :: refresh a page in the browser node js 
Javascript :: index of value in array 
Javascript :: typescript read json file 
Javascript :: command to delete node modules 
Javascript :: get name of class javascript 
Javascript :: jquery fadein display new page 
Javascript :: toggle hook react 
Javascript :: javascript array add end 
Javascript :: dynamic import javascript 
Javascript :: convert days into year, Month, days 
Javascript :: javascript url check 
Javascript :: js reduce a array of straing 
Javascript :: add sass to react 
Javascript :: 12 hours to 24 hours javascript 
Javascript :: google font in react native 
Javascript :: javascript prime number 
Javascript :: js get value of input 
Javascript :: regex is not empty string 
Javascript :: jwt token expire time in node js 
Javascript :: how to delete element in array in javascript 
Javascript :: redux devtools extension 
Javascript :: firestore javascript delete document 
Javascript :: js add html element to div 
Javascript :: how to download express without view 
Javascript :: data transfer object in node 
Javascript :: javascript log html element as dom object 
Javascript :: for object 
Javascript :: axios post 
Javascript :: express js npm 
Javascript :: check if item not in array node js 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =