Re: Determine if a string is digit
От | Josué Maldonado |
---|---|
Тема | Re: Determine if a string is digit |
Дата | |
Msg-id | 3FB4036E.4030006@lamundial.hn обсуждение исходный текст |
Ответ на | Re: Determine if a string is digit (Manuel Sugawara <masm@fciencias.unam.mx>) |
Список | 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 по дате отправления: