ios - @"23.0984" USD to @"23.09 USD" -


i sending urlrequest mentioned below.

nsdata *data = [nsurlconnection sendsynchronousrequest:request returningresponse:nil error:nil];  nsstring *balancestring = [[nsstring alloc] initwithdata:data encoding:nsasciistringencoding]; 

and getting @"23.0984 usd" in balancestring display on uilabel.tex= 23.09 usd please me

nsdata *data = [nsurlconnection sendsynchronousrequest:request returningresponse:nil error:nil];  nsstring *balancestring = [[nsstring alloc] initwithdata:data encoding:nsasciistringencoding]; float amount = [balancestring floatvalue]; // return 23.0984 float nsstring *formattedamount = [nsstring stringwithformat:@"%01.2f usd", amount]; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -