A class for handling strings. More...
#import <OFString.h>
Instance Methods | |
(id) | - initWithUTF8String: |
Initializes an already allocated OFString from a UTF-8 encoded C string. | |
(id) | - initWithUTF8String:length: |
Initializes an already allocated OFString from a UTF-8 encoded C string with the specified length. | |
(id) | - initWithUTF8StringNoCopy:freeWhenDone: |
Initializes an already allocated OFString from an UTF-8 encoded C string without copying it, if possible. | |
(id) | - initWithCString:encoding: |
Initializes an already allocated OFString from a C string with the specified encoding. | |
(id) | - initWithCString:encoding:length: |
Initializes an already allocated OFString from a C string with the specified encoding and length. | |
(id) | - initWithString: |
Initializes an already allocated OFString with another string. | |
(id) | - initWithUnicodeString: |
Initializes an already allocated OFString with a unicode string. | |
(id) | - initWithUnicodeString:byteOrder: |
Initializes an already allocated OFString with a unicode string, assuming the specified byte order if no BOM is found. | |
(id) | - initWithUnicodeString:length: |
Initializes an already allocated OFString with a unicode string with the specified length. | |
(id) | - initWithUnicodeString:byteOrder:length: |
Initializes an already allocated OFString with a unicode string with the specified length, assuming the specified byte order if no BOM is found. | |
(id) | - initWithUTF16String: |
Initializes an already allocated OFString with a UTF-16 string. | |
(id) | - initWithUTF16String:byteOrder: |
Initializes an already allocated OFString with a UTF-16 string, assuming the specified byte order if no BOM is found. | |
(id) | - initWithUTF16String:length: |
Initializes an already allocated OFString with a UTF-16 string with the specified length. | |
(id) | - initWithUTF16String:byteOrder:length: |
Initializes an already allocated OFString with a UTF-16 string with the specified length, assuming the specified byte order if no BOM is found. | |
(id) | - initWithFormat: |
Initializes an already allocated OFString with a format string. | |
(id) | - initWithFormat:arguments: |
Initializes an already allocated OFString with a format string. | |
(id) | - initWithPath: |
Initializes an already allocated OFString with the constructed specified path. | |
(id) | - initWithPath:arguments: |
Initializes an already allocated OFString with the constructed specified path. | |
(id) | - initWithContentsOfFile: |
Initializes an already allocated OFString with the contents of the specified file in the specified encoding. | |
(id) | - initWithContentsOfFile:encoding: |
Initializes an already allocated OFString with the contents of the specified file in the specified encoding. | |
(id) | - initWithContentsOfURL: |
Initializes an already allocated OFString with the contents of the specified URL. | |
(id) | - initWithContentsOfURL:encoding: |
Initializes an already allocated OFString with the contents of the specified URL in the specified encoding. | |
(const char *) | - OF_RETURNS_INNER_POINTER |
Returns the OFString as a UTF-8 encoded C string. | |
(const char *) | - cStringWithEncoding: |
Returns the OFString as a C string in the specified encoding. | |
(size_t) | - length |
Returns the length of the string in Unicode characters. | |
(size_t) | - UTF8StringLength |
Returns the number of bytes the string needs in UTF-8 encoding. | |
(size_t) | - cStringLengthWithEncoding: |
Returns the number of bytes the string needs in the specified encoding. | |
(of_comparison_result_t) | - caseInsensitiveCompare: |
Compares the OFString to another OFString without caring about the case. | |
(of_unichar_t) | - characterAtIndex: |
Returns the Unicode character at the specified index. | |
(void) | - getCharacters:inRange: |
Copies the Unicode characters in the specified range to the specified buffer. | |
(of_range_t) | - rangeOfString: |
Returns the range of the first occurrence of the string. | |
(of_range_t) | - rangeOfString:options: |
Returns the range of the string. | |
(of_range_t) | - rangeOfString:options:range: |
Returns the range of the string in the specified range. | |
(BOOL) | - containsString: |
Returns whether the string contains the specified string. | |
(OFString *) | - substringWithRange: |
Creates a substring with the specified range. | |
(OFString *) | - stringByAppendingString: |
Creates a new string by appending another string. | |
(OFString *) | - stringByAppendingPathComponent: |
Creates a new string by appending a path component. | |
(OFString *) | - stringByPrependingString: |
Creates a new string by prepending another string. | |
(OFString *) | - stringByReplacingOccurrencesOfString:withString: |
Creates a new string by replacing the occurrences of the specified string with the specified replacement. | |
(OFString *) | - stringByReplacingOccurrencesOfString:withString:options:range: |
Creates a new string by replacing the occurrences of the specified string in the specified range with the specified replacement. | |
(OFString *) | - uppercaseString |
Returns the string in uppercase. | |
(OFString *) | - lowercaseString |
Returns the string in lowercase. | |
(OFString *) | - capitalizedString |
Returns the string capitalized. | |
(OFString *) | - stringByDeletingLeadingWhitespaces |
Creates a new string by deleting leading whitespaces. | |
(OFString *) | - stringByDeletingTrailingWhitespaces |
Creates a new string by deleting trailing whitespaces. | |
(OFString *) | - stringByDeletingEnclosingWhitespaces |
Creates a new string by deleting leading and trailing whitespaces. | |
(BOOL) | - hasPrefix: |
Checks whether the string has the specified prefix. | |
(BOOL) | - hasSuffix: |
Checks whether the string has the specified suffix. | |
(OFArray *) | - componentsSeparatedByString: |
Separates an OFString into an OFArray of OFStrings. | |
(OFArray *) | - componentsSeparatedByString:options: |
Separates an OFString into an OFArray of OFStrings. | |
(OFArray *) | - pathComponents |
Returns the components of the path. | |
(OFString *) | - lastPathComponent |
Returns the last component of the path. | |
(OFString *) | - stringByDeletingLastPathComponent |
Returns the directory name of the path. | |
(intmax_t) | - decimalValue |
Returns the decimal value of the string as an intmax_t. | |
(uintmax_t) | - hexadecimalValue |
Returns the hexadecimal value of the string as an uintmax_t. | |
(float) | - floatValue |
Returns the float value of the string as a float. | |
(double) | - doubleValue |
Returns the double value of the string as a double. | |
(const of_unichar_t *) | - OF_RETURNS_INNER_POINTER |
Returns the string as an array of Unicode characters. | |
(const uint16_t *) | - OF_RETURNS_INNER_POINTER |
Returns the string in big endian UTF-16 encoding. | |
(void) | - writeToFile: |
Writes the string into the specified file using UTF-8 encoding. | |
(OFString *) | - MD5Hash |
Returns the MD5 hash of the string as an autoreleased OFString. | |
(OFString *) | - SHA1Hash |
Returns the SHA1 hash of the string as an autoreleased OFString. | |
(id) | - JSONValue |
Creates an object from the JSON value of the string. | |
(id) | - objectByDeserializing |
Deserializes the receiver into an object. | |
(OFString *) | - stringByURLEncoding |
Encodes a string for use in a URL. | |
(OFString *) | - stringByURLDecoding |
Decodes a string used in a URL. | |
(OFString *) | - stringByXMLEscaping |
Escapes a string for use in an XML document. | |
(OFString *) | - stringByXMLUnescaping |
Unescapes XML in the string. | |
(OFString *) | - stringByXMLUnescapingWithDelegate: |
Unescapes XML in the string and uses the specified delegate for unknown entities. | |
Instance Methods inherited from OFObject | |
(id) | - init |
Initializes an already allocated object. | |
(OFString *) | - className |
Returns the name of the object's class. | |
(OFString *) | - description |
Returns a description for the object. | |
(void *) | - allocMemoryWithSize: |
Allocates memory and stores it in the object's memory pool. | |
(void *) | - allocMemoryWithSize:count: |
Allocates memory for the specified number of items and stores it in the object's memory pool. | |
(void *) | - resizeMemory:size: |
Resizes memory in the object's memory pool to the specified size. | |
(void *) | - resizeMemory:size:count: |
Resizes memory in the object's memory pool to the specific number of items of the specified size. | |
(void) | - freeMemory: |
Frees allocated memory and removes it from the object's memory pool. | |
(void) | - dealloc |
Deallocates the object. | |
(void) | - performSelector:afterDelay: |
Performs the specified selector after the specified delay. | |
(void) | - performSelector:withObject:afterDelay: |
Performs the specified selector with the specified object after the specified delay. | |
(void) | - performSelector:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. | |
(void) | - performSelector:onThread:waitUntilDone: |
Performs the specified selector on the specified thread. | |
(void) | - performSelector:onThread:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified object. | |
(void) | - performSelector:onThread:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. | |
(void) | - performSelectorOnMainThread:waitUntilDone: |
Performs the specified selector on the main thread. | |
(void) | - performSelectorOnMainThread:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified object. | |
(void) | - performSelectorOnMainThread:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. | |
(void) | - performSelector:onThread:afterDelay: |
Performs the specified selector on the specified thread after the specified delay. | |
(void) | - performSelector:onThread:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified object after the specified delay. | |
(void) | - performSelector:onThread:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. | |
(OFString *) | - stringBySerializing |
Creates a string by serializing the receiver. | |
Instance Methods inherited from <OFObject> | |
(BOOL) | - isKindOfClass: |
Returns a boolean whether the object of the specified kind. | |
(BOOL) | - isMemberOfClass: |
Returns a boolean whether the object is a member of the specified class. | |
(BOOL) | - respondsToSelector: |
Returns a boolean whether the object responds to the specified selector. | |
(IMP) | - methodForSelector: |
Returns the implementation for the specified selector. | |
(const char *) | - typeEncodingForSelector: |
Returns the type encoding for the specified selector. | |
(id) | - performSelector: |
Performs the specified selector. | |
(id) | - performSelector:withObject: |
Performs the specified selector with the specified object. | |
(id) | - performSelector:withObject:withObject: |
Performs the specified selector with the specified objects. | |
(BOOL) | - isEqual: |
Checks two objects for equality. | |
(uint32_t) | - hash |
Calculates a hash for the object. | |
(id) | - retain |
Increases the retain count. | |
(unsigned int) | - retainCount |
Returns the retain count. | |
(void) | - release |
Decreases the retain count. | |
(id) | - autorelease |
Adds the object to the topmost OFAutoreleasePool of the thread's autorelease pool stack. | |
(id) | - self |
Returns the receiver. | |
(BOOL) | - isProxy |
Returns whether the object is a proxy object. | |
Instance Methods inherited from <OFCopying> | |
(id) | - copy |
Copies the object. | |
Instance Methods inherited from <OFMutableCopying> | |
(id) | - mutableCopy |
Creates a mutable copy of the object. | |
Instance Methods inherited from <OFComparing> | |
(of_comparison_result_t) | - compare: |
Compares the object with another object. | |
Instance Methods inherited from <OFSerialization> | |
(id) | - initWithSerialization: |
Initializes the object with the specified XML element serialization. | |
(OFXMLElement *) | - XMLElementBySerializing |
Serializes the object into an XML element. | |
Instance Methods inherited from <OFJSONRepresentation> | |
(OFString *) | - JSONRepresentation |
Returns the JSON representation of the object as a string. | |
Class Methods | |
(instancetype) | + string |
Creates a new OFString. | |
(instancetype) | + stringWithUTF8String: |
Creates a new OFString from a UTF-8 encoded C string. | |
(instancetype) | + stringWithUTF8String:length: |
Creates a new OFString from a UTF-8 encoded C string with the specified length. | |
(instancetype) | + stringWithCString:encoding: |
Creates a new OFString from a C string with the specified encoding. | |
(instancetype) | + stringWithCString:encoding:length: |
Creates a new OFString from a C string with the specified encoding and length. | |
(instancetype) | + stringWithString: |
Creates a new OFString from another string. | |
(instancetype) | + stringWithUnicodeString: |
Creates a new OFString from a unicode string. | |
(instancetype) | + stringWithUnicodeString:byteOrder: |
Creates a new OFString from a unicode string, assuming the specified byte order if no BOM is found. | |
(instancetype) | + stringWithUnicodeString:length: |
Creates a new OFString from a unicode string with the specified length. | |
(instancetype) | + stringWithUnicodeString:byteOrder:length: |
Creates a new OFString from a unicode string with the specified length, assuming the specified byte order if no BOM is found. | |
(instancetype) | + stringWithUTF16String: |
Creates a new OFString from a UTF-16 encoded string. | |
(instancetype) | + stringWithUTF16String:byteOrder: |
Creates a new OFString from a UTF-16 encoded string, assuming the specified byte order if no BOM is found. | |
(instancetype) | + stringWithUTF16String:length: |
Creates a new OFString from a UTF-16 encoded string with the specified length. | |
(instancetype) | + stringWithUTF16String:byteOrder:length: |
Creates a new OFString from a UTF-16 encoded string with the specified length, assuming the specified byte order if no BOM is found. | |
(instancetype) | + stringWithFormat: |
Creates a new OFString from a format string. | |
(instancetype) | + stringWithPath: |
Creates a new OFString containing the constructed specified path. | |
(instancetype) | + stringWithContentsOfFile: |
Creates a new OFString with the contents of the specified UTF-8 encoded file. | |
(instancetype) | + stringWithContentsOfFile:encoding: |
Creates a new OFString with the contents of the specified file in the specified encoding. | |
(instancetype) | + stringWithContentsOfURL: |
Creates a new OFString with the contents of the specified URL. | |
(instancetype) | + stringWithContentsOfURL:encoding: |
Creates a new OFString with the contents of the specified URL in the specified encoding. | |
Class Methods inherited from OFObject | |
(void) | + load |
A method which is called once when the class is loaded into the runtime. | |
(void) | + initialize |
A method which is called the moment before the first call to the class is being made. | |
(id) | + alloc |
Allocates memory for an instance of the class and sets up the memory pool for the object. | |
(id) | + new |
Allocates memory for a new instance and calls -[init] on it. | |
(Class) | + class |
Returns the class. | |
(OFString *) | + className |
Returns the name of the class as a string. | |
(BOOL) | + isSubclassOfClass: |
Returns a boolean whether the class is a subclass of the specified class. | |
(Class) | + superclass |
Returns the superclass of the class. | |
(BOOL) | + instancesRespondToSelector: |
Checks whether instances of the class respond to a given selector. | |
(BOOL) | + conformsToProtocol: |
Checks whether the class conforms to a given protocol. | |
(IMP) | + instanceMethodForSelector: |
Returns the implementation of the instance method for the specified selector. | |
(const char *) | + typeEncodingForInstanceSelector: |
Returns the type encoding of the instance method for the specified selector. | |
(OFString *) | + description |
Returns a description for the class, which is usually the class name. | |
(IMP) | + replaceClassMethod:withMethodFromClass: |
Replaces a class method with a class method from another class. | |
(IMP) | + replaceInstanceMethod:withMethodFromClass: |
Replaces an instance method with an instance method from another class. | |
(IMP) | + replaceClassMethod:withImplementation:typeEncoding: |
Replaces or adds a class method. | |
(IMP) | + replaceInstanceMethod:withImplementation:typeEncoding: |
Replaces or adds an instance method. | |
(void) | + inheritMethodsFromClass: |
Adds all methods from the specified class to the class that is the receiver. | |
(BOOL) | + resolveClassMethod: |
Try to resolve the specified class method. | |
(BOOL) | + resolveInstanceMethod: |
Try to resolve the specified instance method. | |
Additional Inherited Members | |
Public Attributes inherited from OFObject | |
Class | isa |
The class of the object. | |
A class for handling strings.
Warning: If you add methods to OFString using a category, you are not allowed to access the ivars directly, as these might be still uninitialized for a constant string and get initialized on the first message! Therefore, you should use the corresponding methods to get the ivars, which ensures the constant string is initialized.
- (OFString *) capitalizedString |
Returns the string capitalized.
- (of_comparison_result_t) caseInsensitiveCompare: | (OFString*) | otherString |
- (of_unichar_t) characterAtIndex: | (size_t) | index |
Returns the Unicode character at the specified index.
index | The index of the Unicode character to return |
- (OFArray *) componentsSeparatedByString: | (OFString*) | delimiter | |
options: | (int) | options | |
- (BOOL) containsString: | (OFString*) | string |
Returns whether the string contains the specified string.
string | The string to search |
- (size_t) cStringLengthWithEncoding: | (of_string_encoding_t) | encoding |
Returns the number of bytes the string needs in the specified encoding.
encoding | The encoding for the string |
- (const char *) cStringWithEncoding: | (of_string_encoding_t) | OF_RETURNS_INNER_POINTER |
Returns the OFString as a C string in the specified encoding.
The result is valid until the autorelease pool is released. If you want to use the result outside the scope of the current autorelease pool, you have to copy it.
encoding | The encoding for the C string |
- (intmax_t) decimalValue |
Returns the decimal value of the string as an intmax_t.
Leading and trailing whitespaces are ignored.
If the string contains any non-number characters, an OFInvalidEncodingException is thrown.
If the number is too big to fit into an intmax_t, an OFOutOfRangeException is thrown.
- (double) doubleValue |
Returns the double value of the string as a double.
If the string contains any non-number characters, an OFInvalidEncodingException is thrown.
- (float) floatValue |
Returns the float value of the string as a float.
If the string contains any non-number characters, an OFInvalidEncodingException is thrown.
- (void) getCharacters: | (of_unichar_t*) | buffer | |
inRange: | (of_range_t) | range | |
Copies the Unicode characters in the specified range to the specified buffer.
buffer | The buffer to store the Unicode characters |
range | The range of the Unicode characters to copy |
- (BOOL) hasPrefix: | (OFString*) | prefix |
Checks whether the string has the specified prefix.
prefix | The prefix to check for |
- (BOOL) hasSuffix: | (OFString*) | suffix |
Checks whether the string has the specified suffix.
suffix | The suffix to check for |
- (uintmax_t) hexadecimalValue |
Returns the hexadecimal value of the string as an uintmax_t.
Leading and trailing whitespaces are ignored.
If the string contains any non-number characters, an OFInvalidEncodingException is thrown.
If the number is too big to fit into an uintmax_t, an OFOutOfRangeException is thrown.
- (id) initWithContentsOfFile: | (OFString*) | path |
- (id) initWithContentsOfFile: | (OFString*) | path | |
encoding: | (of_string_encoding_t) | encoding | |
- (id) initWithContentsOfURL: | (OFURL*) | URL |
Initializes an already allocated OFString with the contents of the specified URL.
If the URL's scheme is file, it tries UTF-8 encoding.
If the URL's scheme is http(s), it tries to detect the encoding from the HTTP headers. If it could not detect the encoding using the HTTP headers, it tries UTF-8.
URL | The URL to the contents for the string |
- (id) initWithContentsOfURL: | (OFURL*) | URL | |
encoding: | (of_string_encoding_t) | encoding | |
- (id) initWithCString: | (const char*) | cString | |
encoding: | (of_string_encoding_t) | encoding | |
- (id) initWithCString: | (const char*) | cString | |
encoding: | (of_string_encoding_t) | encoding | |
length: | (size_t) | cStringLength | |
- (id) initWithFormat: | (OFConstantString*) | format | |
, | ... | ||
- (id) initWithFormat: | (OFConstantString*) | format | |
arguments: | (va_list) | arguments | |
Initializes an already allocated OFString with a format string.
See printf for the format syntax. As an addition, %@ is available as format specifier for objects.
format | A string used as format to initialize the OFString |
arguments | The arguments used in the format string |
- (id) initWithPath: | (OFString*) | firstComponent | |
, | ... | ||
- (id) initWithPath: | (OFString*) | firstComponent | |
arguments: | (va_list) | arguments | |
- (id) initWithString: | (OFString*) | string |
- (id) initWithUnicodeString: | (const of_unichar_t*) | string |
- (id) initWithUnicodeString: | (const of_unichar_t*) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
- (id) initWithUnicodeString: | (const of_unichar_t*) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
length: | (size_t) | length | |
Initializes an already allocated OFString with a unicode string with the specified length, assuming the specified byte order if no BOM is found.
string | The unicode string |
byteOrder | The byte order to assume if there is no BOM |
length | The length of the unicode string |
- (id) initWithUnicodeString: | (const of_unichar_t*) | string | |
length: | (size_t) | length | |
- (id) initWithUTF16String: | (const uint16_t*) | string |
- (id) initWithUTF16String: | (const uint16_t*) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
- (id) initWithUTF16String: | (const uint16_t*) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
length: | (size_t) | length | |
Initializes an already allocated OFString with a UTF-16 string with the specified length, assuming the specified byte order if no BOM is found.
string | The UTF-16 string |
byteOrder | The byte order to assume if there is no BOM |
length | The length of the UTF-16 string |
- (id) initWithUTF16String: | (const uint16_t*) | string | |
length: | (size_t) | length | |
- (id) initWithUTF8String: | (const char*) | UTF8String |
- (id) initWithUTF8String: | (const char*) | UTF8String | |
length: | (size_t) | UTF8StringLength | |
- (id) initWithUTF8StringNoCopy: | (const char*) | UTF8String | |
freeWhenDone: | (BOOL) | freeWhenDone | |
Initializes an already allocated OFString from an UTF-8 encoded C string without copying it, if possible.
UTF8String | A UTF-8 encoded C string to initialize the OFString with |
freeWhenDone | Whether to free the C string when it is not needed anymore |
- (id) JSONValue |
Creates an object from the JSON value of the string.
- (OFString *) lastPathComponent |
Returns the last component of the path.
- (size_t) length |
Returns the length of the string in Unicode characters.
- (OFString *) lowercaseString |
Returns the string in lowercase.
- (OFString *) MD5Hash |
Returns the MD5 hash of the string as an autoreleased OFString.
Provided by category OFString(Hashing).
- (id) objectByDeserializing |
Deserializes the receiver into an object.
Provided by category OFString(OFSerialization).
- (const char*) OF_RETURNS_INNER_POINTER |
- (const of_unichar_t*) OF_RETURNS_INNER_POINTER |
Returns the string as an array of Unicode characters.
The result is valid until the autorelease pool is released. If you want to use the result outside the scope of the current autorelease pool, you have to copy it.
- (const uint16_t*) OF_RETURNS_INNER_POINTER |
Returns the string in big endian UTF-16 encoding.
The result is valid until the autorelease pool is released. If you want to use the result outside the scope of the current autorelease pool, you have to copy it.
- (OFArray *) pathComponents |
Returns the components of the path.
- (of_range_t) rangeOfString: | (OFString*) | string |
Returns the range of the first occurrence of the string.
string | The string to search |
- (of_range_t) rangeOfString: | (OFString*) | string | |
options: | (int) | options | |
Returns the range of the string.
string | The string to search |
options | Options modifying search behaviour. Possible values: OF_STRING_SEARCH_BACKWARDS |
- (of_range_t) rangeOfString: | (OFString*) | string | |
options: | (int) | options | |
range: | (of_range_t) | range | |
Returns the range of the string in the specified range.
string | The string to search |
options | Options modifying search behaviour. Possible values: OF_STRING_SEARCH_BACKWARDS |
range | The range in which to search |
- (OFString *) SHA1Hash |
Returns the SHA1 hash of the string as an autoreleased OFString.
Provided by category OFString(Hashing).
Creates a new string by appending a path component.
component | The path component to append |
Creates a new string by appending another string.
string | The string to append |
- (OFString *) stringByDeletingEnclosingWhitespaces |
Creates a new string by deleting leading and trailing whitespaces.
- (OFString *) stringByDeletingLastPathComponent |
Returns the directory name of the path.
- (OFString *) stringByDeletingLeadingWhitespaces |
Creates a new string by deleting leading whitespaces.
- (OFString *) stringByDeletingTrailingWhitespaces |
Creates a new string by deleting trailing whitespaces.
Creates a new string by prepending another string.
string | The string to prepend |
- (OFString *) stringByReplacingOccurrencesOfString: | (OFString*) | string | |
withString: | (OFString*) | replacement | |
Creates a new string by replacing the occurrences of the specified string with the specified replacement.
string | The string to replace |
replacement | The string with which it should be replaced |
- (OFString *) stringByReplacingOccurrencesOfString: | (OFString*) | string | |
withString: | (OFString*) | replacement | |
options: | (int) | options | |
range: | (of_range_t) | range | |
Creates a new string by replacing the occurrences of the specified string in the specified range with the specified replacement.
string | The string to replace |
replacement | The string with which it should be replaced |
options | Options modifying search behaviour. Possible values: None yet |
range | The range in which to replace the string |
- (OFString *) stringByURLDecoding |
Decodes a string used in a URL.
Provided by category OFString(URLEncoding).
- (OFString *) stringByURLEncoding |
Encodes a string for use in a URL.
Provided by category OFString(URLEncoding).
- (OFString *) stringByXMLEscaping |
Escapes a string for use in an XML document.
Provided by category OFString(XMLEscaping).
- (OFString *) stringByXMLUnescapingWithDelegate: | (id <OFStringXMLUnescapingDelegate>) | delegate |
Unescapes XML in the string and uses the specified delegate for unknown entities.
delegate | An OFXMLUnescapingDelegate as a handler for unknown entities |
Provided by category OFString(XMLUnescaping).
+ (instancetype) stringWithContentsOfFile: | (OFString*) | path |
+ (instancetype) stringWithContentsOfFile: | (OFString*) | path | |
encoding: | (of_string_encoding_t) | encoding | |
+ (instancetype) stringWithContentsOfURL: | (OFURL*) | URL |
Creates a new OFString with the contents of the specified URL.
If the URL's scheme is file, it tries UTF-8 encoding.
If the URL's scheme is http(s), it tries to detect the encoding from the HTTP headers. If it could not detect the encoding using the HTTP headers, it tries UTF-8.
URL | The URL to the contents for the string |
+ (instancetype) stringWithContentsOfURL: | (OFURL*) | URL | |
encoding: | (of_string_encoding_t) | encoding | |
+ (instancetype) stringWithCString: | (const char*) | cString | |
encoding: | (of_string_encoding_t) | encoding | |
+ (instancetype) stringWithCString: | (const char*) | cString | |
encoding: | (of_string_encoding_t) | encoding | |
length: | (size_t) | cStringLength | |
+ (instancetype) stringWithFormat: | (OFConstantString*) | format | |
, | ... | ||
+ (instancetype) stringWithPath: | (OFString*) | firstComponent | |
, | ... | ||
+ (instancetype) stringWithString: | (OFString*) | string |
+ (instancetype) stringWithUnicodeString: | (const of_unichar_t*) | string |
+ (instancetype) stringWithUnicodeString: | (const of_unichar_t*) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
+ (instancetype) stringWithUnicodeString: | (const of_unichar_t*) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
length: | (size_t) | length | |
+ (instancetype) stringWithUnicodeString: | (const of_unichar_t*) | string | |
length: | (size_t) | length | |
+ (instancetype) stringWithUTF16String: | (const uint16_t*) | string |
+ (instancetype) stringWithUTF16String: | (const uint16_t*) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
+ (instancetype) stringWithUTF16String: | (const uint16_t*) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
length: | (size_t) | length | |
+ (instancetype) stringWithUTF16String: | (const uint16_t*) | string | |
length: | (size_t) | length | |
+ (instancetype) stringWithUTF8String: | (const char*) | UTF8String |
+ (instancetype) stringWithUTF8String: | (const char*) | UTF8String | |
length: | (size_t) | UTF8StringLength | |
- (OFString *) substringWithRange: | (of_range_t) | range |
Creates a substring with the specified range.
range | The range of the substring |
- (OFString *) uppercaseString |
Returns the string in uppercase.
- (size_t) UTF8StringLength |
Returns the number of bytes the string needs in UTF-8 encoding.
- (void) writeToFile: | (OFString*) | path |
Writes the string into the specified file using UTF-8 encoding.
path | The path of the file to write to |