连接int和字符串 [英] Concatenate int and string

查看:134
本文介绍了连接int和字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将int(例如:4)和字符串(例如:@"/12")连接起来进行打印?

How can I concatenate an int (e.g: 4) and a string (e.g: @"/12") for printing?

我可以将int强制转换为NSString格式,但是我不知道如何在int的值后面添加@"/12".

I'm okay with casting the int it to an NSString format, but I don't know how I can add @"/12" after the int's value.

推荐答案

我没有收到您的问题,但我认为您的意思是这样的:

I don't get your question, but I think you mean something like this:

...[NSString stringWithFormat:@"%d/12", intValue]

这篇关于连接int和字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆