Is there an easy way to programmatically get the alphabet?

前端 未结 5 1419
臣服心动
臣服心动 2021-02-04 12:11

I want an NSArray/NSMutableArray containing all the letters of the alphabet. There must be a quick and easy way, better than typing them all out. For example in PHP

5条回答
  •  自闭症患者
    2021-02-04 13:11

    There's no quicker way than typing them all out, unless you cut and paste my handy reference from below!

    "abcdefghijklmnopqrstuvwxyz"


    For the sake of it, here's a longer way.

    for (char a = 'a'; a <= 'z'; a++)
    {
      [myArray addObject:[NSString stringWithFormat:@"%c", a]];
    }
    

提交回复
热议问题