jvanegmond Posted October 26, 2009 Share Posted October 26, 2009 (edited) Or you could just hush and keep your opinions to yourself until you see what we actually do... in a few months.I have developed a small game, and (co-) ran a small gaming community. The only thing the community did was 'offer suggestions', all the time, non-stop. It almost always came down to 'omhagawd please fix this'.Just saying I know how this feels. Edited October 26, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
memoryoverflow Posted October 26, 2009 Share Posted October 26, 2009 (edited) I'd expect strings that represent a valid number to be converted to that number and an error thrown by the conversion for all other strings. So I'd expect '5abc' to be not converted at all, neither 5 nor 0, i.e. both options don't make sense for me. <ot> Here's what I'm currently doing to get there:Local $i = 0, $asResult[3] = ['hex', 'NaN', 'dec'] Local $asTest = StringSplit('-123.45e+12|-.1|23.E-9|0.|+.0| 12|001 || |0xfedcba98|-|2l0|10O0|12,345.67|9e|e8|7-6|+ 5|4.3.21|9 8|7+e6|5e4.3|2f1|1.2e-', '|') Local $sRxNaDec = '(?i)[^-+.e\d\s]|\..*\.|e.*[^-+\d]|\A[^-+.\d\s]|[^.\d\s]\z|[^\A\s]\s[^\z\s]|[^e\A\s][-+]' Local $sRxIsHex = '(?i)\A0x[\da-f]{1,8}\z' For $i = 1 To $asTest[0] ConsoleWrite(StringFormat('%15s %s', $asTest[$i], $asResult[2 - StringRegExp($asTest[$i], $sRxIsHex) - StringRegExp($asTest[$i], $sRxNaDec)]) & ' ''Number(…)'' = ' & Number($asTest[$i]) & @crlf) NextThe degree of permissiveness is certainly subject to dicussion. (And in the above I don't allow thousand seperators, because I'd do so only after processing the locale settings as well.) </ot> Edited October 26, 2009 by memoryoverflow (The signature is placed on the back of this page to not disturb the flow of the thread.) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now