我想将时间格式更改为1到1,00
代码:
lblLoggedHoursValue.text = [lblLoggedHoursValue.text stringByReplacingOccurrencesOfString:@"." withString:@","];
答案 0 :(得分:0)
这里我在浮动中转换你的值然后在替换之后。
lblLoggedHoursValue.text = @"1";
lblLoggedHoursValue.text = [NSString stringWithFormat:@"%.2f",[lblLoggedHoursValue.text floatValue]];
NSLog(@"%@",lblLoggedHoursValue.text); //Output : 1.00
现在将lblLoggedHoursValue.text(。)替换为(,)
lblLoggedHoursValue.text = [lblLoggedHoursValue.text stringByReplacingOccurrencesOfString:@"." withString:@","];
NSLog(@"%@",lblLoggedHoursValue.text); //Output : 1,00