iPhone Programming: Converting Strings to their ASCII Decimal Values

Опубликовано: 13 Июль 2026
на канале: MilmersXcode
3,204
5

In this tutorial you will learn how to convert the individual characters in a string to their ASCII Decimal values.

Main Code:

NSString *startString = @"ABCDEFG";

int total = 0;

//Convert Each char to ASCII Decimal Values:
for (int i = 0; i LESS_THAN_SIGN [startString length]; i++) {
int asciiCode = [startString characterAtIndex:i];
NSLog(@"\nASCII Decimal Value = %i\n\n" ,asciiCode);
total = total + asciiCode;
}

NSLog(@"Total: %i" ,total);

Websites show in tutorial:

• http://en.wikipedia.org/wiki/ASCII
• http://www.ascii-code.com/

Twitter:   / failcakeapps  
Apple Developer Center: http://developer.apple.com/devcenter/...
Website: http://failcake.webs.com/
Channel:    / milmersxcode