1825{
1827
1828 NSMutableString *result =
nil;
1829 NSUInteger i, length;
1830 unichar c;
1831 NSAutoreleasePool *pool =
nil;
1832
1833 length = [self length];
1834 result = [NSMutableString stringWithCapacity:length];
1835
1836
1837 pool = [[NSAutoreleasePool alloc] init];
1838 for (i = 0; i != length; ++i)
1839 {
1840 c = [self characterAtIndex:i];
1841 switch (c)
1842 {
1843 case '\\':
1844 [result appendString:@"\\\\"];
1845 break;
1846
1847 case '\b':
1848 [result appendString:@"\\b"];
1849 break;
1850
1851 case '\f':
1852 [result appendString:@"\\f"];
1853 break;
1854
1855 case '\n':
1856 [result appendString:@"\\n"];
1857 break;
1858
1859 case '\r':
1860 [result appendString:@"\\r"];
1861 break;
1862
1863 case '\t':
1864 [result appendString:@"\\t"];
1865 break;
1866
1867 case '\v':
1868 [result appendString:@"\\v"];
1869 break;
1870
1871 case '\'':
1872 [result appendString:@"\\\'"];
1873 break;
1874
1875 case '\"':
1876 [result appendString:@"\\\""];
1877 break;
1878
1879 default:
1880 [result appendString:[NSString stringWithCharacters:&c length:1]];
1881 }
1882 }
1883 [pool release];
1884 return result;
1885
1887}