안드로이드 개발 정보
(글 수 1,068)
찾아보니 검색해도 없는거 같아서 올립니다.
cocos2d-x 2.0 부터는 createWithFormat 이라는것이 있지만, cocos2d-x 1.0 에서는 없더라고요.
class KS_Util
{
public:
static string stringWithFormat(const char* _Format, ...)
{
va_list argptr;
va_start(argptr, _Format);
char buf[256];
int ret = vsprintf(buf, _Format, argptr);
string str = buf;
va_end(argptr);
return str;
}
};
string zz = KS_Util::stringWithFormat("dsafsadf %d", 345345); 이런식으로 쓰시면 됩니다.
자바의 String.format랑 같은건가보군요 ``