我的用户默认值.plist
中有一个值<key>hex</key>
<data>5448495344414e475448494e474e45454453544f53544159484558</data>
我如何把它放到这样的char []中:
char hex[] = {0x54,0x48,etc..}
我四处搜寻,但没有找到任何例子。我已经尝试了我能想到的一切。
enum {
NSBinarySearchingFirstEqual = (1 << 8),
NSBinarySearchingLastEqual = (1 << 9),
NSBinarySearchingInsertionIndex = (1 << 10),
};
typedef NSUInteger NSBinarySearchingOptions;
NSString *str = @"string";
const char *myChar = "some string";
if (strcmp(myChar, str.UTF8String))
or
[str isEqualToString:[NSString stringWithUTF8String:myChar]];
CFStringRef myStr = CFSTR("some chars");
bool result = CFStringCompareWithOptions(myStr, ((__bridge CFStringRef)str),CFRangeMake(0,CFStringGetLength(myStr)), kCFCompareCaseInsensitive);
int someInteger = 42;
float someFloatingPointNumber = 3.1415;
double someDoublePrecisionFloatingPointNumber = 6.02214199e23;
int someInteger = 42;
someInteger++; // someInteger == 43
int anotherInteger = 64;
anotherInteger--; // anotherInteger == 63
anotherInteger *= 2; // anotherInteger == 126
If you use a scalar type for an Objective-C property, like this:
@interface XYZCalculator : NSObject
@property double currentValue;
@end
@implementation XYZCalculator
- (void)increment {
self.currentValue++;
}
- (void)decrement {
self.currentValue--;
}
- (void)multiplyBy:(double)factor {
self.currentValue *= factor;
}
@end
short myint;
long myint;
unsigned myint;
signed myint;
我问了一个类似的问题,但不是这个问题。