How to convert ASCII value to a character in Objective-C?

后端 未结 2 1096
感情败类
感情败类 2020-12-01 03:32

I was wondering if anyone has the following php function equivalents in Objective-C for iPhone development:

  1. ord() # returns the ASCII value of the first charac
2条回答
  •  春和景丽
    2020-12-01 03:58

    //char to int ASCII-code
    char c = 'a';
    int ascii_code = (int)c;
    
    //int to char
    int i = 65; // A
    c = (char)i;
    

提交回复
热议问题