Friday, January 17, 2020

How to know if a converted string to float is really a float number ?

HI,

According to str2float help, I have tried this :

'3,3e+004'->substitute(',', '.', 'g')->str2float() which return 33000 number.

According to good conversion in this case it is a float num but if I replace by cases where it is not a well form of num that no have to be converted. 


'3,3e+00.4'->substitute(',', '.', 'g')->str2float() which return ????  there is a dot char in exp...
'3,3e+0O4'->substitute(',', '.', 'g')->str2float() which return ????  there is char 'O' out of zero


How to prevent unnecessary conversion ?

Thank you

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20b9a263-d9fa-4596-a044-7aeacd6787c8%40googlegroups.com.

No comments: