“Remova caracteres especiais” Respostas de código

Remova caracteres especiais da string

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

Remova caracteres especiais

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);
		}
Nilesh

Como remover caracteres especiais de uma 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;
}
Weary Wallaby

Respostas semelhantes a “Remova caracteres especiais”

Perguntas semelhantes a “Remova caracteres especiais”

Mais respostas relacionadas para “Remova caracteres especiais” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código