科学表記法の文字列を実際の数値に変換しようとしています。
私のテスト文字列は次のようにフォーマットされています:
myString = 1.000000000000000E+00, 2.000000000000000E+02, -1.000000000000000E+05
私の現在のコード:
elements = {}
for s in myString:gmatch('%d+%.?%d*') do
table.insert(elements, s);
end
return unpack(elements);
Elements は次のエラーを返します:
1.000000000000000 %from the first number before "E"
00 %after the "E" in the first number
2.000000000000000 %from the second number before "E"
これを修正する方法を知っている人はいますか?