PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Finding a specific character in a String (Windev Mobile 18)
Finding a specific character in a String (Windev Mobile 18)
Iniciado por guest, 23,oct. 2015 10:20 - 4 respuestas
Publicado el 23,octubre 2015 - 10:20
Hi everyone,

I have created a string variable and I need to find out if there are any forbidden characters in the string before I send it through webservices to SQL. Ideally I am looking for some code such as....

IF sInterrogatestring CONTAINS "@" THEN
Info("Please remove restricted characters")
END

Any advice is much appreciated.

Thank you! :)
Publicado el 23,octubre 2015 - 11:28
Hi,

Please take a look at position function, ex:

if Position(MyString, "@") <> 0 then
// @ was found in the string
end

Regards,

Bruno
Publicado el 23,octubre 2015 - 11:35
Ben,
Position() is your friend

IF Position(sInterrogatestring,"@") > 0 THEN
Info("Please remove restricted characters")
END
Publicado el 23,octubre 2015 - 11:52
Thank you so much!
Publicado el 23,octubre 2015 - 14:16
Hi Ben,

if you have to check for more than one character you could use

IF Position(sInterrogatestring,["@","\","/"]) > 0 THEN
Info("Please remove restricted characters")
END