3
我想使用parseInt方法轉換字符串的前兩個字符,但我不能。它應該是這樣的:解析一個子串?
String firstChars = IntMessage.substring(0,2);// firstChars is a String that corresponds to the first two characters of the string.
message=ASCII[(Integer.parseInt(firstChar))-32];//The message variable is a String that is supposed to take a firstChars variable and make it an integer so it can be used by the ASCII array in determining which element of the array is to be concatenated to the message String.
例如,如果前兩個字符是98,我想採取串並轉換成一個int。
什麼語言?標記它。 –
這看起來像/應該/工作。你是否得到一個特定的編譯器/運行時錯誤? – millimoose
定義「不能」......並且當然會發佈顯示問題的實際代碼。 –