Re: Determine if a string is digit - Mailing list pgsql-general

From Josué Maldonado
Subject Re: Determine if a string is digit
Date
Msg-id 3FB4036E.4030006@lamundial.hn
Whole thread Raw
In response to Re: Determine if a string is digit  (Manuel Sugawara <masm@fciencias.unam.mx>)
List pgsql-general
Thanks Manuel,

It works nice!

Manuel Sugawara wrote:

> Josué Maldonado <josue@lamundial.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.



pgsql-general by date:

Previous
From: Manuel Sugawara
Date:
Subject: Re: Determine if a string is digit
Next
From: Bruno Wolff III
Date:
Subject: Re: simple question