1.遇到问题
我在编写一个判断这个字符串是否为数值字符串时遇到了问题,
无法将已经转换为数组类型中的元素(也就是:字符串中的字符)与字符比较;
2.下面是我的代码:
public static double convert(String value) {
double a = 0;
char charArray[] = value.toCharArray();
//数值字符串
for (int i=0; i<value.length(); i++) {
if (charArray[i] == '.') continue;
else (charArray[i]<'0' && charArray[i]>'9') { //是出错行!!!!!!
return 0.0;
}
}
a = Double.valueOf(value.toString());
return a;
}
3.他的报错为:
Multiple markers at this line
- The left-hand side of an assignment must be a variable
- Syntax error, insert "AssignmentOperator Expression" to complete
Assignment
- Syntax error, insert ";" to complete Statement
4.谢谢您诚恳的回答。