好虫不要吵架了 win10 10547# PDA - 掌中宝
s*x
1 楼
说一下思路吧,懒得写代码
1 skip white spaces
2 skip + or - if there is one.
3 skip all numeric digits, say n1 digits are skipped.
4 skip . if there is one
5 same as step 3, but save count to n2.
6 here is the key part, return false if n1 + n2 == 0.
7. Skip E or e if there is one.
8 if there is e or E, do step 2 and 3, return false if n1 == 0
9 skip white space
10 return false if string is empty now, otherwise return true.
Simple, fast and hard to make mistakes.
1 skip white spaces
2 skip + or - if there is one.
3 skip all numeric digits, say n1 digits are skipped.
4 skip . if there is one
5 same as step 3, but save count to n2.
6 here is the key part, return false if n1 + n2 == 0.
7. Skip E or e if there is one.
8 if there is e or E, do step 2 and 3, return false if n1 == 0
9 skip white space
10 return false if string is empty now, otherwise return true.
Simple, fast and hard to make mistakes.