F.A
F.A

Reputation: 3

NSString to NSData in ios

I have written a code like this :

NSString *Input  = @"1";
NSMutableData *InputData = [Input dataUsingEncoding:NSASCIIStringEncoding];

I expected that the InputData be 48 , but it was 31 . Did I do something wrong ?

Upvotes: 0

Views: 90

Answers (1)

tommyo
tommyo

Reputation: 551

(Added as response by request)

In ASCII '1' is 49, not 48, which is 0x31. Are you maybe confusing them?

Upvotes: 2

Related Questions