With some high-level languages such as JavaScript or PHP, where the data are not typed or otherwise can not be, we are "spoiled" in compare or convert strings and integers and vice versa, all hidden or manipulated by the interpreter (or compiler ). For example, in JavaScript functions are "forced" (like parseInt() for example) required in special cases. However, in other circumstances we treat without worrying about a particular integer conversions (explicit), such as:
1 2 3 | 5 ; mioNumero var = 5; / / ... "Il valore di mioNumero è " + mioNumero ) ; alert ("The value of mioNumero is" + mioNumero); |
In Objective-C, however, the data type is important and the type conversion must be explicit. Besides the casting (better typecasting) we can use the features and functionality specific to the type conversion. For example, here is how to convert an integer to a string:
1 2 3 4 |
In contrast, here is how to convert a string to an integer:
1 2 3 4 | miaStringa = @ "128" ; NSString * myString = @ "128"; [ miaStringa integerValue ] ; mioNumero int = [myString integerValue]; / / "miaStringa=%@ mioNumero=%i" , miaStringa, mioNumero ) ; NSLog (@ "myString = @ mioNumero% =% i", myString, mioNumero); |






Latest Comments
Robert : I rispsoto your questions with pleasure. The idea is really great. I am looking for a solution ...
Sting : @ Darius - you can see an example here: http://www.fight4fun.it/ clicking on: MAPS I hope ...
vik : Giustappunto I'm working on a project and the client asked me to show all the news (which are CPT) in ...
Giovambattista Fazioli : @ paso: absolutely. Simply identifying the field [cci] input [/ cci] you want to ...
paso : Hello I would like to request a service, you can use the datepicker with cform7 I spiegp best I can implement ...