Split NSString into array of characters?

Discussion in 'iOS Programming' started by tsornin, Sep 23, 2008.

  1. tsornin macrumors newbie

    Joined:
    Jul 23, 2002
    #1
    Is there a way to split a string into an array of individual characters? I've tried this but it doesn't seem to work:

    NSString *foo = @"The quick brown fox";
    NSArray *chars = [foo componentsSeparatedByString:mad:""];

    But then the length of chars is 1, and chars[0] contains the entire string rather than just "T".

    I must be missing something obvious...
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    You can turn them into a C array of unicode characters with getCharacters:.
     

Share This Page