Quote:
Originally Posted by shinoda
No hay nada que explicar allí, eso es muy básico. De todas formas, regex es mejor en estos casos:
PHP Code:
#include <amxmodx>
#include <regex>
new Regex:RegexHandle, iRet
new const szPattern[ ] = "[^^\w_ ]" // Patron
new const szInput [ ] = "1Ola k-2 ase" // Texto a analizar
public plugin_init( )
{
new szError[ 64 ]
if( (RegexHandle = regex_compile(szPattern, iRet, szError, charsmax(szError))) < REGEX_OK )
{
log_amx( "Error (%i): %s", iRet, szError )
pause( "ad" )
}
}
public some_func( )
{
if( regex_match_c(szInput, RegexHandle, iRet) > 0 )
{
// Caracter raro encontrado
}
else
{
// Los caracteres no-raros son:
// Letras (mayusculas o minusculas),
// Numeros
// Subguiones y espacios
}
}
|
depende xD; igual nunca me aprendí como hacer el patron con regex xD
lucas: lo unico q hice fue chequear los caracteres... es lo mismo xD
__________________