Split NSString into array of characters?

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

  1. tsornin macrumors newbie

    Jul 23, 2002
    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


    Jul 24, 2002
    You can turn them into a C array of unicode characters with getCharacters:.

Share This Page