科学记数法数字的正则表达式? [英] Regex for numbers on scientific notation?

查看:38
本文介绍了科学记数法数字的正则表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在加载一个包含类似行的 .obj 文件

I'm loading a .obj file that has lines like

vn 8.67548e-017 1 -1.55211e-016

vn 8.67548e-017 1 -1.55211e-016

用于顶点法线.我如何检测它们并将它们带入双重符号?

for the vertex normals. How can I detect them and bring them to double notation?

推荐答案

标准库函数 strtod 可以很好地处理指数分量(atof 也是如此,但是 strtod 允许您区分失败的解析和解析值为零).

The standard library function strtod handles the exponential component just fine (so does atof, but strtod allows you to differentiate between a failed parse and parsing the value zero).

这篇关于科学记数法数字的正则表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆