Thursday, December 5, 2013

100 help a super simple question! ! ! ! ! ! ! ! ! ! ! ! ! !

A very simple question that I want a string every 76 characters plus a carriage return line feed
For example, to convert the string into
AAAAABBBBBCCCCC
Reply:
I have not finished jerking off on the release. . . .

For example, to convert the string into
AAAAABBBBBCCCCCAAAAA \ r \ n
BBBBBB \ r \ n
CCCCC \ r \ n

I was born C # does not OBJECTIVE-C ah

After resolving the remaining issues Open posted 60 points are given,
Reply:
Try this


/ * -------- Strings behind the string has been inserted into the specified location given ------ * /

/ /-InsertString: atIndex:
NSMutableString * String1 = [[NSMutableString alloc] initWithString: @ "This is a NSMutableString"];
[String1 insertString: @ "Hi!" AtIndex: 0];
NSLog (@ "String1:% @", String1);

Reply:
This method can
- (NSString *) stringByReplacingCharactersInRange: (NSRange) range withString: (NSString *) replacement
Reply:
NSMutableString * allString = [NSMutableString string];
int index = (int) ([string lenth] / 10);
for (int i = 0; i {
nsstring strSub = [string substringWithRange: NSMakeRange (i * 10,10)];
allString = [allString stringByAppendingFormat:% @ n, strSub];
}
return allString;
Reply:
Just wanted to find a way to insert or replace the string with the help of document NSString, see which way, there should be a lot of, upstairs also offers several methods

No comments:

Post a Comment