|
Pages: [1]
|
 |
|
Author
|
Topic: really simple function... (Read 212 times)
|
|
Ishida
|
validate-email: function [input] [valid][ valid: false (if (type? input) = email! [set [valid] [true]]) return valid ]
i pass in a variable 'input' and if it is a email variable type it return true.. else it returns false.Right now, it ALWAYS returns false. -_-
I need to make a REBOL email validator.. taking baby steps right now.. baby step #1 is a problem already...
|
|
|
|
|
Logged
|
|
|
|
|
Sunanda
|
I'm not sure if you are asking a question about improving your first function. If you are not: then congratulations! It works which is 95% of what counts. If you are, then I'll offer: validate-email: function [input] [][ return email? input ]
|
|
|
|
|
Logged
|
|
|
|
|
notchent
|
Yep, it works  Are you using your function like this? validate-email email@domain.com validate-email "this isn't an email"
|
|
|
|
|
Logged
|
|
|
|
|
DideC
|
What must be said is that email! is a datatype in Rebol. So it's a kind of data like integer! or tuple! So your function just check that your input value is of type email!, not that it is a valide email address. In fact there is the 'email? function that just do that (feed this in a console) : input: toto@alo.com email? input
input: "I'm a string, not an email" email? input
input: to-email input email? input In fact, email! is just a kind of string! write without quote/bracket nor space and with an @ inside. You have to understand this to go further.
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |