objective c - NSMutableString appendString in first position -
i have nsmutablestring variable append astring, this:
nsstring *astring = [nsstring stringwithformat:@"{\"mycode\":%@,\"totalamount\":%@,\"paymenttype\":\"%@\",\"bankname\":\"%@\",\"bankaccountno\":\"%@\",\"amount\":\"%@\",\"filename\":\"%@\"}",acode,total,type,labelbank.txt,labelacc.txt,atrasfer,imagename]; [teststring appendstring:asstring2]; [teststring appendstring:@","];
in code sucess append string in order append. know want append new string in first position, in array object @ index 0.can nsmutablestring this?
hope question clear..thanks
you said it, index. same way array.
- (void)insertstring:(nsstring *)astring atindex:(nsuinteger)anindex
your code:
[teststring appendstring:astring]; [teststring insertstring:@"," atindex:0]; /* prepend comma
check out documentation
Comments
Post a Comment