[Gambas-user] print does not output if the var is FALSE, how to override?

PICCORO McKAY Lenz mckaygerhard at gmail.com
Fri Jun 29 19:44:00 CEST 2018


2018-06-29 13:21 GMT-04:00 Tobias Boege <taboege at gmail.com>:

> No, it's not normal, as I said two mails ago. It should print "False"
> as a string.
>
in my main function i return as Variant.. that's may be the problem..

ok how can i force the type of result from variant to boolean

my function :

Public Function email(texto As Variant) As Variant

    Dim regex As New RegExp
    Dim strPattern As String = "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,8}$"

    If regex.Match(texto, strPattern, regex.Caseless) = True Then
            Return texto
    Endif

    Return False

End

when i used as:

    Print exu.email("mpes") & " y este " & exu.email("email at mail.com")

does not print "False" due the "Variant" implication i guess, so how can i
emulated the php behaviour?




>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180629/eaab5714/attachment.html>


More information about the User mailing list