FIrst, thanks to all who responded to my first two questions. I have tried what was suggested and still nothing works. I thought I would create another post with the code that I am using. Just for some background: I am creating a guessing game for my son and I need to change characters form character to decimal to character. I have added the code and the logs. I hope this is more helpful.
-(IBAction)CHANGE:(id)sender
NSString *working_text;
NSInteger working_text_length;
NSInteger new_key_char_num;
NSInteger key_char_num;
NSInteger key_char_position = 0;
NSInteger char_num = 0;
NSString *altered_text;
working_text = UITextView_1.text;
working_text_length = working_text.length;
altered_text = @"";
UITextView_1.text = @"";
int k = 0;
while (k < working_text_length)
{
char_num = [working_text characterAtIndex:k];
key_char_num = 65;
new_key_char_num = char_num + key_char_num;
UITextView_1.text = [UITextView_1.text
stringByAppendingFormat:@"%c",new_key_char_num];
NSLog(@"char_num................%c",char_num);
NSLog(@"char_num................%d",char_num);
NSLog(@"key_char_num........... %d",key_char_num);
NSLog(@"new_key_char_num........%d",new_key_char_num);
NSLog(@"new_key_char_num........%c",new_key_char_num);
NSLog(@" ");
char_num = 0;
k++;
}
NSLog(@"UITextView_1.text full text...%@",UITextView_1.text);
NSLog(@"first %c",[UITextView_1.text characterAtIndex:0]);
NSLog(@"second %c",[UITextView_1.text characterAtIndex:1]);
NSLog(@"third %c",[UITextView_1.text characterAtIndex:2]);
// release code is not shown
}
LOGS
2009-10-04 22:43:04.949 DaVinci SMS[20757:20b] char_num................A
2009-10-04 22:43:04.951 DaVinci SMS[20757:20b] char_num................65
2009-10-04 22:43:04.951 DaVinci SMS[20757:20b] key_char_num........... 65
2009-10-04 22:43:04.952 DaVinci SMS[20757:20b] new_key_char_num........130
2009-10-04 22:43:04.953 DaVinci SMS[20757:20b] new_key_char_num........Ç
2009-10-04 22:43:04.953 DaVinci SMS[20757:20b]
2009-10-04 22:43:04.954 DaVinci SMS[20757:20b] char_num................B
2009-10-04 22:43:04.955 DaVinci SMS[20757:20b] char_num................66
2009-10-04 22:43:04.956 DaVinci SMS[20757:20b] key_char_num........... 65
2009-10-04 22:43:04.956 DaVinci SMS[20757:20b] new_key_char_num........131
2009-10-04 22:43:04.957 DaVinci SMS[20757:20b] new_key_char_num........É
2009-10-04 22:43:04.957 DaVinci SMS[20757:20b]
2009-10-04 22:43:04.958 DaVinci SMS[20757:20b] char_num................C
2009-10-04 22:43:04.959 DaVinci SMS[20757:20b] char_num................67
2009-10-04 22:43:04.959 DaVinci SMS[20757:20b] key_char_num........... 65
2009-10-04 22:43:04.960 DaVinci SMS[20757:20b] new_key_char_num........132
2009-10-04 22:43:04.960 DaVinci SMS[20757:20b] new_key_char_num........Ñ
2009-10-04 22:43:04.961 DaVinci SMS[20757:20b]
2009-10-04 22:43:04.961 DaVinci SMS[20757:20b] UITextView_1.text...ÇÉÑ
2009-10-04 22:43:04.962 DaVinci SMS[20757:20b] first «
2009-10-04 22:43:04.962 DaVinci SMS[20757:20b] second …
2009-10-04 22:43:04.963 DaVinci SMS[20757:20b] third —
I entered the characters 'ABC' in the UITextView. I am just using three characters for now. If you notice at the bottome og the log the complete UITextView_1.text string is not equal to the individual characters that I pull using the characterAtIndex method. This is driving me crazy.