class Solution {
public boolean areNumbersAscending(String s) {
char[] ch = s.toCharArray();
int pre = -1;
for (int i = 0; i < ch.length; ) {
// 不是数字
if (ch[i] < '0' || ch[i] > '9') {
i++;
continue;
}
// 取字符串中该数字的值
int temp = 0;
while (i < ch.length && ch[i] >= '0' && ch[i] <= '9') {
temp *= 10;
temp += ch[i] - '0';
i++;
}
// 判断是否递增
if (temp <= pre) return false;
else pre = temp;
}
return true;
}
}
标签:ch,2042,数字,int,递增,句子
From: https://www.cnblogs.com/eiffelzero/p/17022866.html