Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6688317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:23:26+00:00 2026-05-26T05:23:26+00:00

When I use componentsJoinedByString , I just get a long string of digits. Edit:

  • 0

When I use componentsJoinedByString, I just get a long string of digits.

Edit: I realize this task is confusing. Why on earth would anyone populate an NSArray with NSNumbers if they wanted an NSString? The answer is that I’m writing an extensible unit test framework. The basic functions genNum, genBool, and genChar generate NSNumbers with random int, BOOL, and char values respectively. Then there’s genArray which generates a random array using a specified generator. So to construct a random NSString, one would run genArray using the genChar generator, and transform the resulting NSArray into an NSString.

The characters are only stored as NSNumbers instead of chars due to a technicality: genArray accepts a block and calls the block 100-odd times to populate the NSArray. Blocks must hold ObjC objects; not primitive types.

So the question remains: How do you join an NSArray of [NSNumber numberWithChar: c]’s into an NSString?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:23:27+00:00Added an answer on May 26, 2026 at 5:23 am
    + (NSString *) genString {
        NSArray* arr = [self genArray: ^() { return [ObjCheck genChar]; }];
    
        NSMutableString* s = [NSMutableString stringWithCapacity: [arr count]];
    
        int i;
        for (i = 0; i < [arr count]; i++) {
            [s appendString: [NSString stringWithFormat: @"%c", [[arr objectAtIndex: i] charValue]]];
        }
    
        return s;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

use this website a lot but first time posting. My program creates a number
Use case: I've just entered insert mode, and typed some text. Now I want
Use Case I need to package up our kml which is in a String
use WWW::Mechanize; my $mech = WWW::Mechanize->new; $mech->get( $url ); say $mech->text; How could I
Use trap to capture signals like this: i=-1;while((++i<33)); do trap echo $i >> log.txt
Use OPENXML to get dt element in MSSQL 2005. How can I get xmlns:dt
use DBI(); What is causing this insert to fail to err 1, the SELECT
Use case is this: I want to unit test (in browser, QUnit or something
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
Use case: A does something on his box and gots stuck. He asks B

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.