I created an unicode char array using ‘characterAtIndex:’ from an NSString object.
I want to make the characters in the array again into a single complete string.
Is there any method to convert this unicahr Array into NSStirng?
Can anyone please help me???
This s my code:
NSString *sentence = @"A long string";
NSString *new = [[NSString alloc]init];
unichar aBuffer[[sent length]];
int j=0;
//Tried to reverse the string:
for (int i=[sent length]-1; i>=0; i--,j++) {
aBuffer[j]=[sent characterAtIndex:i];
}
I found a better way for sting reversal than this, but let me know whether we have any method for this…
Is the array a standard c array? (looks something like this:
array[50];) If it is, you can do this: