ios - point a String to a list of constants and get the constant value -


i'd know how possible point string list of constants , constant value. have list of hundreds constants declared in .m follow:

nsstring *const onenumber = @"2.58"; nsstring *const twonumber = @"3.58"; nsstring *const threenumber = @"2.72"; // , on... 

below have "mystring" value give me same name of 1 of constants:

nsstring *mystring= [[nsstring alloc] initwithformat:@"%@number", mynumber]; //mynumber isequal one,two,three etc... 

how can displayed value of number specified in constant in label without use hundreds of if statements?

result.text= [[nsstring alloc]initwithformat:@"%@", ????? ]; 

thanks answers in advance.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -