Re: [fpc-pascal] Verify if string is a valid number

2008-11-23 Thread Felipe Monteiro de Carvalho
thanks, Val worked nicely =) -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Verify if string is a valid number

2008-11-23 Thread Michael Van Canneyt
On Sun, 23 Nov 2008, Graeme Geldenhuys wrote: > On Sun, Nov 23, 2008 at 6:23 PM, Johann Glaser <[EMAIL PROTECTED]> wrote: > > Always avoid exceptions if possible, since they are very costly in terms > > CPU time. > > I know this was the rule of thumb in Delphi 5-7 days... Does this > still appl

Re: [fpc-pascal] Verify if string is a valid number

2008-11-23 Thread Graeme Geldenhuys
On Sun, Nov 23, 2008 at 6:23 PM, Johann Glaser <[EMAIL PROTECTED]> wrote: > Always avoid exceptions if possible, since they are very costly in terms > CPU time. I know this was the rule of thumb in Delphi 5-7 days... Does this still apply today, with newer compilers and much faster CPU's? Just cu

Re: [fpc-pascal] Verify if string is a valid number

2008-11-23 Thread Michael Van Canneyt
On Sun, 23 Nov 2008, Felipe Monteiro de Carvalho wrote: > Hello, > > I would like to verify if a string is a valid number, as in StrToInt > will work when applied to it. The obvious way is making a try > statement: > > try > StrToInt(TokenStr); > AdicionarToken(tNumeroLit

Re: [fpc-pascal] Verify if string is a valid number

2008-11-23 Thread Johann Glaser
Hi! Am Sonntag, den 23.11.2008, 14:18 -0200 schrieb Felipe Monteiro de Carvalho: > Hello, > > I would like to verify if a string is a valid number, as in StrToInt > will work when applied to it. The obvious way is making a try > statement: > > try > StrToInt(TokenStr); > Ad

Re: [fpc-pascal] Verify if string is a valid number

2008-11-23 Thread Frank de Groot / Rent-a-Geek
Have a look at TryStrToInt. - Original Message - From: "Felipe Monteiro de Carvalho" <[EMAIL PROTECTED]> To: "FPC-Pascal users discussions" Sent: Sunday, November 23, 2008 5:18 PM Subject: [fpc-pascal] Verify if string is a valid number It's easy to build such a routine, but I was

[fpc-pascal] Verify if string is a valid number

2008-11-23 Thread Felipe Monteiro de Carvalho
Hello, I would like to verify if a string is a valid number, as in StrToInt will work when applied to it. The obvious way is making a try statement: try StrToInt(TokenStr); AdicionarToken(tNumeroLiteral, TokenStr); except AdicionarToken(tId, TokenStr); en