Make a string encoder in objective-C -
i beginner of learning how code , want write string coder. string coder, mean if input word "abc", output "cde". is, every character move plus 2.
i'm able convert single character, example: input "a" -> output "c".
but i'm not sure how input word instead of character.
char password[40]; nslog(@" plz come in password"); scanf("%s",password); nsstring *tempcode = [nsstring stringwithcstring:password encoding:1]; //nslog(@"test %@", tempcode); int decode, asciicode = [tempcode characteratindex:0]; //nslog(@"test %d", asciicode); decode = asciicode + 2; nsstring *decodenum = [nsstring stringwithformat:@"%c", decode]; nslog(@"%@", decodenum); objective-c string ascii encode
No comments:
Post a Comment