在Java中,我们使用$ currency格式来执行此语句.
double num1 = 3.99 ;
double num2 = 1.00 ;
double total = num1 + num2;
System.out.printf ("Total: $ %.2f", total);
Run Code Online (Sandbox Code Playgroud)
结果是:
总计:4.99美元
// --------------------------------
现在在iOS中,如果我有以下语句,我怎么能得到相同的格式:
total.text = [NSString stringWithFormat:@"$ %d",([self.coursePriceLabel.text intValue])+([self.courseEPPLabel.text intValue])+10];
Run Code Online (Sandbox Code Playgroud)
注意:
如果我使用doubleValue,则输出始终为0.
如何在编辑表单中的HTML下拉列表中设置选定的值?
所选值来自MySql
这段代码不行!! >> selected =""
<select name="TutorGender" id="TutorGender" selected="<?php echo $Gender ?>">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
Run Code Online (Sandbox Code Playgroud)