本帖最后由 yanpflove 于 2019-1-14 16:33 编辑
回复 3# hccaiwh
多谢指导,您提供的函数很好用,可我通过阅读关于atof和atoi的cadence help文档,没有想明白为什么不建议使用这两个函数,是不是这两个函数容易产生什么问题呢?是因为atof()不能识别“u”、“f”等单位吗?能请您补充一下吗?
- atof
- atof( t_string ) => f_result/nil
- Description:
- Converts a string into a floating-point number. Returns nil if the given string does not denote
- a number.
- The atof function calls the C library function strtod to convert a string into a floating-point
- number. It returns nil if t_string does not represent a number.
- Arguments:
- t_string A string.
- Value Returned:
- f_result The floating-point value represented by t_string.
- nil If t_string does not denote a floating-point number.
- Example:
- atof("123") => 123.0
- atof("abc") => nil
- atof("123.456") => 123.456
- atof("123abc") => 123.0
复制代码
|