int intProjectNumber = [[projectNumber stringByTrimmingCharactersInSet:whitespaceCharacterSet] integerValue];
edit: Just to explain a little more.
If you have an NSString named projectNumber (for example, @ "4"). You can create a new line with a clipped space infront of the line and after the line with
NSString *trimedProjectNumber = [projectNumber stringByTrimmingCharactersInSet:whitespaceCharacterSet];
as you can see, this replaces the trim () function
trimedProjectNumber will now be @ "4". If you want to get an integer representation of this string:
int intProjectNumber = [trimedProjectNumber integerValue];
it replaces parseInt ..
I don't know java, but I think this is what youre code does? Unless you explain what java code does ..
Larsjk
source share