m anew comer to iPhone...before i have developed for Andr开发者_如何学Gooid..Could any one tell me what is the alternate code in objective C..Thanx in advance
Int projectNumber = Integer.parseInt(projectNumber.trim());
int intProjectNumber = [[projectNumber stringByTrimmingCharactersInSet:whitespaceCharacterSet] integerValue];
edit: Just to explain a bit more..
If you have a NSString named projectNumber (ie. @" 4 "). You can make a new string with trimed whitespace infront of the string and after the string with
NSString *trimedProjectNumber = [projectNumber stringByTrimmingCharactersInSet:whitespaceCharacterSet];
as you can see this replaces the trim() function
trimedProjectNumber would now be @"4". If you want an integer representation of this string you do:
int intProjectNumber = [trimedProjectNumber integerValue];
this replaces the parseInt..
I dont know java but i think this is what youre code does? If not explain what the java code does..
精彩评论