Character occurrences in a String Objective C

后端 未结 7 1574
生来不讨喜
生来不讨喜 2021-02-19 19:01

How can I count the occurrence of a character in a string?

Example

String: 123-456-7890

I want to find the occurrence count of \"-\

7条回答
  •  别跟我提以往
    2021-02-19 19:57

    I did this for you. try this.

    unichar findC;
    int count = 0;
    NSString *strr = @"123-456-7890";
    
    for (int i = 0; i

提交回复
热议问题