Re: Determine if a string is digit

From: Josué Maldonado <josue(at)lamundial(dot)hn>
To: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Determine if a string is digit
Date: 2003-11-13 22:19:26
Message-ID: 3FB4036E.4030006@lamundial.hn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Manuel,

It works nice!

Manuel Sugawara wrote:

> Josué Maldonado <josue(at)lamundial(dot)hn> writes:
>
>
>>Hello list,
>>
>>That's my question, I can't figure out a way to know if a given string is
>>digit, soemthing like this:
>>
>>
>>ISDIGIT("ARWA") = False
>>ISDIGIT("5334") = True
>>
>>If anyone know a way to get that done, I'll appreciate the help.
>
>
> create function isdigit(text) returns boolean as '
> select $1 ~ ''^(-)?[0-9]+$'' as result
> ' language sql;
>
> masm=# select isdigit('ARWA');
> isdigit
> ---------
> f
> (1 row)
>
> masm=# select isdigit('5334');
> isdigit
> ---------
> t
> (1 row)
>
> Regards,
> Manuel.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>

--
Josué Maldonado.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-11-13 22:25:44 Re: More Praise for 7.4RC2
Previous Message Manuel Sugawara 2003-11-13 22:10:56 Re: Determine if a string is digit