- NSString * dictString = [dict JSONFragment]; // combined.
Use this...
- DictString = {"content": "Sadgfdfg", "phoneno": "", "email": "1049055935@qq.com" }==
-
- // Convert the hexadecimal format to a normal string.
- + (NSString *) stringFromHexString :( NSString *) hexString {//
-
- Char * myBuffer = (char *) malloc (int) [hexString length]/2 + 1 );
- Bzero (myBuffer, [hexString length]/2 + 1 );
- For (int I = 0; I <[hexString length]-1; I ++ = 2 ){
- Unsigned int anInt;
- NSString * hexCharStr = [hexString substringWithRange: NSMakeRange (I, 2)];
- NSScanner * Records = [[[NSScanner alloc] initWithString: hexCharStr] autorelease];
- [Export scanHexInt: & anInt];
- MyBuffer [I/2] = (char) anInt;
- }
- NSString * unicodeString = [NSString stringWithCString: myBuffer encoding: 4];
- NSLog (@ "------ string =======%@", unicodeString );
- Return unicodeString;
-
-
- }
-
- // Convert a normal string to a hexadecimal string.
-
- + (NSString *) hexStringFromString :( NSString *) string {
- NSData * myD = [string dataUsingEncoding: NSUTF8StringEncoding];
- Byte * bytes = (Byte *) [myD bytes];
- // The following is a hexadecimal Byte conversion.
- NSString * hexStr = @"";
- For (int I = 0; I <[myD length]; I ++)
-
- {
- NSString * newHexStr = [NSString stringWithFormat: @ "% x", bytes [I] & 0xff]; // hexadecimal number
-
- If ([newHexStr length] = 1)
-
- HexStr = [NSString stringWithFormat: @ "% @ 0% @", hexStr, newHexStr];
-
- Else
-
- HexStr = [NSString stringWithFormat: @ "% @", hexStr, newHexStr];
- }
- Return hexStr;
- }