aryaxt
aryaxt

Reputation: 77596

Objective C ==> char ==> Special characters?

char c1 = 'A';
char c2 = 'F';
char final = (char) c1^c2;

This always return the result i am looking for, but it doesn't work if either c1 or c2 contain special characters. Any idea what i can change to allow special characters? Thanks

Upvotes: 1

Views: 943

Answers (1)

user269597
user269597

Reputation:

"Special Characters" could mean any number of things. If you're trying to represent Unicode code points (which are 32-bit) in chars (which are 8-bit) you're going to encounter problems. Consider using unichar instead.

You may also want to consider using NSStrings instead of managing individual characters yourself, since they take character set into account.

Upvotes: 1

Related Questions