Why does casting to double using "String * 1" fail? Will CDbl(String) work on all systems?
Posted
by
Jamie Bull
on Stack Overflow
See other posts from Stack Overflow
or by Jamie Bull
Published on 2012-10-30T09:35:29Z
Indexed on
2012/10/31
17:00 UTC
Read the original article
Hit count: 192
I have an application which contains the line below to assign a parsed XML value to a variant array.
V(2) = latNode.Text * 1
This works fine on my system (Windows 7, Excel 2010) but doesn't work on some other system or systems - and I've not been able to get a response from the user who reported the problem.
I've switched out the offending line for:
V(2) = CDbl(latNode.Text)
This still works on my system, but then I had no problem in the first place. The question is on what systems does the first approach fail and why, and will the second method always work? I'm sure I've used the "Stying * 1" trick elsewhere before and would like to know how concerned I should be about tracking down other occurrences.
Thanks.
© Stack Overflow or respective owner