English 中文(简体)
如何在 iphone 应用程序中的 HTML 字符串中添加或 Cancateate 字符串
原标题:how to add or cancatenate string in a HTML string in iphone app
  • 时间:2012-05-23 06:07:55
  •  标签:
  • iphone

我有 html 字符串, 我想在 Web 视图中装入它, 但我想要一些我因此得到的值, 所以我想在运行时也添加这些值 。

I have a string belwo i want this value to be added with line so that it should display Number of dogs that visit clinic ? 12 like this

 NSString*dogspermonth=12;

 Number of dogs that visit clinic? <br>


 NSString*htmlString=@"<HTML>
 <HEAD>
 <TITLE>JAMSHED ALI</TITLE>
 </HEAD>
<BODY background="InsideBackgroundPage2.png">
<H6><font color="white">Cerenia Motion Sickness<br>
Model</br>Report
<p>Inputs</p>
<br>
 Number of dogs that visit clinic? <br>
 Number of dogs with motion sickness <br>
 Dogs treated with (per year):      <br>

Cerenia <br>                                       
Other prescription drugs<br>
Other means<br>                            
Other the counter drugs<br>  
<p>
Average cost to client for Cerenia prescription<br>      
Clinic markup<br><br>


Average number of dogs treated for car sickness<br>
Total number of dogs treated for car sickness<br>
Dogs treated with Cerenia<br>
Dogs treated with other drugs or interventions<br>

<br>  
  Profit for each Cerenia prescription<br>
  Annual Profit earned from Cerenia treatment<br>
  Potential annual profit increase  from using Cerenia to treat all dogs with motion sickness<br>
 Maximum annual profit if all dogs with car sickness were treated with Cerenia<br>
</BODY>
 </head>";
最佳回答

头一

NSString*dogspermonth=12; //is wrong
NSString *dogspermonth=@"12"; //is correct if u want string else
NSInteger dogspermonth = 12; //will suffice

下个 u 可以使用字符串与套用格式相似 :

NSString *htmlString= [NSString stringWithFormat:@"<HTML>
 <HEAD>
 <TITLE>JAMSHED ALI</TITLE>
 </HEAD>
<BODY background="InsideBackgroundPage2.png">
<H6><font color="white">Cerenia Motion Sickness<br>
Model</br>Report
<p>Inputs</p>
<br>
 Number of dogs that visit clinic? %@<br> //%@ if string //%d if integer
 Number of dogs with motion sickness <br>
 Dogs treated with (per year):      <br>

Cerenia <br>                                       
Other prescription drugs<br>
Other means<br>                            
Other the counter drugs<br>  
<p>
Average cost to client for Cerenia prescription<br>      
Clinic markup<br><br>


Average number of dogs treated for car sickness<br>
Total number of dogs treated for car sickness<br>
Dogs treated with Cerenia<br>
Dogs treated with other drugs or interventions<br>

<br>  
  Profit for each Cerenia prescription<br>
  Annual Profit earned from Cerenia treatment<br>
  Potential annual profit increase  from using Cerenia to treat all dogs with motion sickness<br>
 Maximum annual profit if all dogs with car sickness were treated with Cerenia<br>
</BODY>
 </head>", dogspermonth];

希望它有所帮助。 快乐的编码 : )

问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签