开发者

Converting string values to their metric equivalents in actionscript?

Can anyone suggest the best approach for metric conversion of string values? for instance distance values,and temperatures

For instance say I have a string containing some unknown inches value

And the inches sign can either be the proper double prime OR double quotes.

So, I'm guessing as a first step I would search for double prime or double quotes preceded by a number value, then parse out and convert this number value. But this doesn't seem foolproof for instances when it is actually a doublequote, NOT an in开发者_JAVA技巧ches sign


You can split your input string like this:

split('"')

or this:

split("''")

Then pass the results of the returned array to parseInt() or parseFloat().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜