中的角色,我有這樣的代碼檢查字符串
if(!(lotNo.charAt(0) >= "0" && (lotNo.charAt(0) <= "7"))) {
// if the first character is not within these boundaries
return false;
}
return true;
這種方法給我留下了一個錯誤說bad operator type
?雖然它應該檢查字符串中的第一個字符是否在0和7之間。我在正確的行嗎?
乾杯大家,我甚至不知道「」和「之間有區別?你們都救了我幾個小時的壓力:) –