Skip to content
Newer
Older
100644 65 lines (51 sloc) 2.19 KB
dc5be1c Initial check-in.
uli authored
1 //
2 // NSString+EscapeString.h
3 // ValueConverter
4 //
5 // Created by Uli Kusterer on 27.11.04.
720b0e7 @uliwitness Added licensing information to the source files.
authored
6 // Copyright 2004 Uli Kusterer.
7 //
8 // This software is provided 'as-is', without any express or implied
9 // warranty. In no event will the authors be held liable for any damages
10 // arising from the use of this software.
11 //
12 // Permission is granted to anyone to use this software for any purpose,
13 // including commercial applications, and to alter it and redistribute it
14 // freely, subject to the following restrictions:
15 //
16 // 1. The origin of this software must not be misrepresented; you must not
17 // claim that you wrote the original software. If you use this software
18 // in a product, an acknowledgment in the product documentation would be
19 // appreciated but is not required.
20 //
21 // 2. Altered source versions must be plainly marked as such, and must not be
22 // misrepresented as being the original software.
23 //
24 // 3. This notice may not be removed or altered from any source
25 // distribution.
dc5be1c Initial check-in.
uli authored
26 //
27
28 /*
29 Escape any non-ASCII characters in a string for use in e.g. C source code.
30 Some known characters get symbolic names like \n, all others are turned into
31 Hex (\x0F). The uppercase/lowercase parts of the names refer to the hex
32 strings generated, which can be \xAF or \xaf etc.
33
34 Currently, only one-byte characters are encoded correctly. The high byte is
35 stripped.
36 */
37
38 // -----------------------------------------------------------------------------
39 // Headers:
40 // -----------------------------------------------------------------------------
41
42 #import <Cocoa/Cocoa.h>
43
44
45 // -----------------------------------------------------------------------------
46 // Categories:
47 // -----------------------------------------------------------------------------
48
49 @interface NSString (UKEscapeString)
50
51 -(NSString*) escapedString;
52 -(NSString*) uppercaseEscapedString;
53 -(NSString*) escapedStringUppercase: (BOOL)uc;
54
55 -(NSString*) unescapedString; // Restores escaped string to normal.
56
57
58 @end
59
60
61 // -----------------------------------------------------------------------------
62 // Prototypes:
63 // -----------------------------------------------------------------------------
64
65 int UKHexToDec( char n );
Something went wrong with that request. Please try again.