我有我希望成爲一個非常簡單的問題。我非常簡單地試圖將char轉換爲小寫版本。這裏是我的代碼:整型在處理可可中的字符串中鑄造
- (IBAction)click:(id)sender {
[outputLabel setText:[inputField text]];
NSString* textFieldString = [inputField text];
NSLog(@"String is %@", textFieldString);
int textFieldLength = textFieldString.length;
UniChar* currChar = [textFieldString characterAtIndex:0];
NSLog(@"First char is %c", currChar);
NSLog(@"Length is %i", textFieldLength);
//currChar = [currChar lowercaseString];
//NSLog(@"Lowercase char is %c", currChar);
}
它給了我下面的錯誤:
Initialization makes pointer from integer without a cast on the line:
NSString* currChar = [textFieldString characterAtIndex:0];
然而,在文檔中觀察時,它說,characterAtIndex:
返回一個字符,而不是一個整數的方法。是什麼賦予了?