TalkingCode
TalkingCode

Reputation: 13557

How to type a square character in Xcode?

How do I type a square character in Xcode? Not as program code but in a string.

I tried to copy a character but its not working. I am still stuck with:

aCounty.area = @"301.338 km2";

Upvotes: 0

Views: 2757

Answers (1)

justin
justin

Reputation: 104698

    const UniChar square = 0x00B2;
    NSString * str = [NSString stringWithFormat:@"%C", square];
    NSLog(@"301 km%@", str);

you can get the character code from OS X's "Special Characters…" menu item

Upvotes: 4

Related Questions