Convert NSString to an int?

Discussion in 'iOS Development' started by gojohnnyboi, May 23, 2008.

  1. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    Ok, im making a small command line utility, and i have a string initted with argv[2]

    i want to convert this string to an integer for an NSTimer that i have in the utility...

    how do i do this?


    Thanks,
    -John
  2. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    NVM. got it.


    Code:
    int i;
    NSString* string;
    
    i = [string intValue];
    that converts the intValue of a string to an int

Share This Page