String to ascii conversion, xor it with another integer. Objective-C

Discussion in 'iOS Programming' started by xcoder1987, Mar 30, 2011.

  1. xcoder1987, Mar 30, 2011
    Last edited by a moderator: Mar 30, 2011

    xcoder1987 macrumors newbie

    Mar 30, 2011
    Hello, I have a string from which using for-loop ,each char has been converted into ascii and then xored with an integer. I converted each output back to its relevant char. I need to print all those output characters all at once on the label field in the iphone GUI.

    I not able to get the part where I need to print them all onto the label field. Here is the code. Any help is appreciated. Thanks in advance

    -(IBAction)result {
    NSString *str = [[NSString alloc] initWithFormat:@"%@", [sword text]];
    for ( NSInteger i=0; i<[str length]; i++ )
        unichar c = [str characterAtIndex:i];
        int asciiCode1 = ([kword.text intValue]);
        int z = asciiCode1 ^ c;
         int a = (char)z;
    label.text = [NSString stringWithFormat:@"  %c", a];
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Posting the same question on different forums at the same time is considered rude, Rahul. I'm sure you think your time is valuable. So does everyone else.
  3. xcoder1987 thread starter macrumors newbie

    Mar 30, 2011
    I am quiet new to using forums and dint know that the users would be common. I apologize for that.
  4. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    IMO, it's reasonable to make a second post to another forum after a reasonable time with no good response. Like 24 hours.

    People take time to write their responses. It's not fair to have people take time to respond if you've already gotten a response in another forum. And if there are multiple responses on one forum those readers on the other forum probably won't see them.

    Anyway, you've gotten a response on the other forum.
  5. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    When posting code that doesn't compile, say "It doesn't compile", and provide the exact text of the error message, preferably by copy and pasting it.

Share This Page