What's the best way to detect forbidden chars in string?

Get help using Construct 2

Post » Mon May 25, 2015 7:22 am

Right now, I am using the find function and search through a string for any character that is forbidden. I only allow 0-9, A-Z, a-z, and @. While using the find function for all the forbidden characters do work, the checklist itself is long and it looks ugly. Is there a better way to achieve this? Basically a function that returns -1 if there is any other character beside 0-9, a-Z, A-Z and @.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Mon May 25, 2015 8:32 am

this would work:
Image
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Mon May 25, 2015 8:48 am

If you want to know if what is entered is a valid e-mail, you should consider using Regex

https://www.scirra.com/tutorials/1337/e ... t-2/page-1

And here's the expression used in Regex to find a valid e-mail-adress:

http://www.regular-expressions.info/email.html

\b[A-Z0-9._%+-][email protected][A-Z0-9.-]+\.[A-Z]{2,4}\b
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: arvivlx2 and 3 guests

cron