Talk:Determine if a string is numeric: Difference between revisions

Line 68:
 
:As it was before, the code say the "123Not Numeric" is numeric... I made it so that it says it is numeric iff the whole string is a number. (By the way, this one says numeric for float, other implementation here would say that "123.3" is not numeric since they check for integer only...) --[[User:ShinTakezou|ShinTakezou]] 23:12, 11 December 2008 (UTC)
 
== How literally need the examples follow the task? ==
 
The task description says »A number in the syntax the language uses for literals« and that floating-point numbers should be included. First off, this probable invalidates any solution that uses the language's normal string-to-number routines since those usually are locale-aware. A string like <code>1.234.567,141</code> will convert fine on my system (using <code>de-DE</code> as locale but wouldn't be a valid numeric literal in the programming languages I know.
 
Furthermore – similar to the VB discussion above – many programming languages allow floating point numbers to be in the form <code>1.23e15</code> which is currently handled by very few, if any, examples. In a similar vein, hexadecimal, octal or binary numeric literals – in C and languages that follow its conventions closely, <code>09</code> would ''not'' be a valid numeric literal. —[[User:Hypftier|Johannes Rössel]] 17:56, 6 July 2010 (UTC)
Anonymous user