ObjFW
|
A class for handling strings. More...
#import <ObjFW/OFString.h>
Instance Methods | |
(instancetype) | - initWithUTF8String: |
Initializes an already allocated OFString from a UTF-8 encoded C string. More... | |
(instancetype) | - initWithUTF8String:length: |
Initializes an already allocated OFString from a UTF-8 encoded C string with the specified length. More... | |
(instancetype) | - initWithUTF8StringNoCopy:freeWhenDone: |
Initializes an already allocated OFString from an UTF-8 encoded C string without copying the string, if possible. More... | |
(instancetype) | - initWithUTF8StringNoCopy:length:freeWhenDone: |
Initializes an already allocated OFString from an UTF-8 encoded C string with the specified length without copying the string, if possible. More... | |
(instancetype) | - initWithCString:encoding: |
Initializes an already allocated OFString from a C string with the specified encoding. More... | |
(instancetype) | - initWithCString:encoding:length: |
Initializes an already allocated OFString from a C string with the specified encoding and length. More... | |
(instancetype) | - initWithData:encoding: |
Initializes an already allocated OFString from OFData with the specified encoding. More... | |
(instancetype) | - initWithString: |
Initializes an already allocated OFString with another string. More... | |
(instancetype) | - initWithCharacters:length: |
Initializes an already allocated OFString with a Unicode string with the specified length. More... | |
(instancetype) | - initWithUTF16String: |
Initializes an already allocated OFString with a UTF-16 string. More... | |
(instancetype) | - initWithUTF16String:length: |
Initializes an already allocated OFString with a UTF-16 string with the specified length. More... | |
(instancetype) | - initWithUTF16String:byteOrder: |
Initializes an already allocated OFString with a UTF-16 string, assuming the specified byte order if no byte order mark is found. More... | |
(instancetype) | - initWithUTF16String:length:byteOrder: |
Initializes an already allocated OFString with a UTF-16 string with the specified length, assuming the specified byte order if no byte order mark is found. More... | |
(instancetype) | - initWithUTF32String: |
Initializes an already allocated OFString with a UTF-32 string. More... | |
(instancetype) | - initWithUTF32String:length: |
Initializes an already allocated OFString with a UTF-32 string with the specified length. More... | |
(instancetype) | - initWithUTF32String:byteOrder: |
Initializes an already allocated OFString with a UTF-32 string, assuming the specified byte order if no byte order mark is found. More... | |
(instancetype) | - initWithUTF32String:length:byteOrder: |
Initializes an already allocated OFString with a UTF-32 string with the specified length, assuming the specified byte order if no byte order mark is found. More... | |
(instancetype) | - initWithFormat: |
Initializes an already allocated OFString with a format string. More... | |
(instancetype) | - initWithFormat:arguments: |
Initializes an already allocated OFString with a format string. More... | |
(instancetype) | - initWithContentsOfFile: |
Initializes an already allocated OFString with the contents of the specified file in the specified encoding. More... | |
(instancetype) | - initWithContentsOfFile:encoding: |
Initializes an already allocated OFString with the contents of the specified file in the specified encoding. More... | |
(instancetype) | - initWithContentsOfURL: |
Initializes an already allocated OFString with the contents of the specified URL. More... | |
(instancetype) | - initWithContentsOfURL:encoding: |
Initializes an already allocated OFString with the contents of the specified URL in the specified encoding. More... | |
(size_t) | - getCString:maxLength:encoding: |
Writes the OFString into the specified C string with the specified encoding. More... | |
(size_t) | - getLossyCString:maxLength:encoding: |
Writes the OFString into the specified C string with the specified encoding, replacing characters that cannot be represented in the specified encoding with a question mark. More... | |
(const char *) | - cStringWithEncoding: |
Returns the OFString as a C string in the specified encoding. More... | |
(const char *) | - lossyCStringWithEncoding: |
Returns the OFString as a C string in the specified encoding, replacing characters that cannot be represented in the specified encoding with a question mark. More... | |
(size_t) | - cStringLengthWithEncoding: |
Returns the number of bytes the string needs in the specified encoding. More... | |
(of_comparison_result_t) | - caseInsensitiveCompare: |
Compares the OFString to another OFString without caring about the case. More... | |
(of_unichar_t) | - characterAtIndex: |
Returns the Unicode character at the specified index. More... | |
(void) | - getCharacters:inRange: |
Copies the Unicode characters in the specified range to the specified buffer. More... | |
(of_range_t) | - rangeOfString: |
Returns the range of the first occurrence of the string. More... | |
(of_range_t) | - rangeOfString:options: |
Returns the range of the string. More... | |
(of_range_t) | - rangeOfString:options:range: |
Returns the range of the string in the specified range. More... | |
(size_t) | - indexOfCharacterFromSet: |
Returns the index of the first character from the set. More... | |
(size_t) | - indexOfCharacterFromSet:options: |
Returns the index of the first character from the set. More... | |
(size_t) | - indexOfCharacterFromSet:options:range: |
Returns the index of the first character from the set. More... | |
(bool) | - containsString: |
Returns whether the string contains the specified string. More... | |
(OFString *) | - substringFromIndex: |
Creates a substring from the specified index to the end. More... | |
(OFString *) | - substringToIndex: |
Creates a substring from the beginning to the specified index. More... | |
(OFString *) | - substringWithRange: |
Creates a substring with the specified range. More... | |
(long long) | - longLongValueWithBase: |
The value of the string in the specified base as a long long . More... | |
(unsigned long long) | - unsignedLongLongValueWithBase: |
The value of the string in the specified base as an unsigned long long . More... | |
(OFString *) | - stringByAppendingString: |
Creates a new string by appending another string. More... | |
(OFString *) | - stringByAppendingFormat: |
Creates a new string by appending the specified format. More... | |
(OFString *) | - stringByAppendingFormat:arguments: |
Creates a new string by appending the specified format. More... | |
(OFString *) | - stringByPrependingString: |
Creates a new string by prepending another string. More... | |
(OFString *) | - stringByReplacingOccurrencesOfString:withString: |
Creates a new string by replacing the occurrences of the specified string with the specified replacement. More... | |
(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. More... | |
(bool) | - hasPrefix: |
Checks whether the string has the specified prefix. More... | |
(bool) | - hasSuffix: |
Checks whether the string has the specified suffix. More... | |
(OFArray *) | - componentsSeparatedByString: |
Separates the string into an array of strings, split by the specified delimiter. More... | |
(OFArray *) | - componentsSeparatedByString:options: |
Separates the string into an array of strings, split by the specified delimiter. More... | |
(OFArray *) | - componentsSeparatedByCharactersInSet: |
Separates the string into an array of strings, split by characters in the specified set. More... | |
(OFArray *) | - componentsSeparatedByCharactersInSet:options: |
Separates the string into an array of strings, split by characters in the specified set. More... | |
(const of_char16_t *) | - UTF16StringWithByteOrder: |
Returns the string in UTF-16 encoding with the specified byte order. More... | |
(const of_char32_t *) | - UTF32StringWithByteOrder: |
Returns the string in UTF-32 encoding with the specified byte order. More... | |
(OFData *) | - dataWithEncoding: |
Returns the string as OFData with the specified encoding. More... | |
(void) | - writeToFile: |
Writes the string into the specified file using UTF-8 encoding. More... | |
(void) | - writeToFile:encoding: |
Writes the string into the specified file using the specified encoding. More... | |
(void) | - writeToURL: |
Writes the string to the specified URL using UTF-8 encoding. More... | |
(void) | - writeToURL:encoding: |
Writes the string to the specified URL using the specified encoding. More... | |
(void) | - enumerateLinesUsingBlock: |
block The block to call for each line More... | |
(id) | - objectByParsingJSONWithDepthLimit: |
Creates an object from the JSON value of the string. More... | |
(OFString *) | - stringByAppendingPathComponent: |
Creates a new string by appending a path component. More... | |
(OFString *) | - stringByURLEncodingWithAllowedCharacters: |
Encodes a string for use in a URL, but does not escape the specified allowed characters. More... | |
(OFString *) | - stringByXMLUnescapingWithDelegate: |
Unescapes XML in the string and uses the specified delegate for unknown entities. More... | |
(OFString *) | - stringByXMLUnescapingWithBlock: |
Unescapes XML in the string and uses the specified block for unknown entities. More... | |
![]() | |
(instancetype) | - init |
Initializes an already allocated object. More... | |
(nullable OFMethodSignature *) | - methodSignatureForSelector: |
Returns the method signature for the specified selector. More... | |
(void) | - dealloc |
Deallocates the object. More... | |
(void) | - performSelector:afterDelay: |
Performs the specified selector after the specified delay. More... | |
(void) | - performSelector:withObject:afterDelay: |
Performs the specified selector with the specified object after the specified delay. More... | |
(void) | - performSelector:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. More... | |
(void) | - performSelector:withObject:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. More... | |
(void) | - performSelector:withObject:withObject:withObject:withObject:afterDelay: |
Performs the specified selector with the specified objects after the specified delay. More... | |
(void) | - performSelector:onThread:waitUntilDone: |
Performs the specified selector on the specified thread. More... | |
(void) | - performSelector:onThread:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified object. More... | |
(void) | - performSelector:onThread:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. More... | |
(void) | - performSelector:onThread:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. More... | |
(void) | - performSelector:onThread:withObject:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the specified thread with the specified objects. More... | |
(void) | - performSelectorOnMainThread:waitUntilDone: |
Performs the specified selector on the main thread. More... | |
(void) | - performSelectorOnMainThread:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified object. More... | |
(void) | - performSelectorOnMainThread:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. More... | |
(void) | - performSelectorOnMainThread:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. More... | |
(void) | - performSelectorOnMainThread:withObject:withObject:withObject:withObject:waitUntilDone: |
Performs the specified selector on the main thread with the specified objects. More... | |
(void) | - performSelector:onThread:afterDelay: |
Performs the specified selector on the specified thread after the specified delay. More... | |
(void) | - performSelector:onThread:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified object after the specified delay. More... | |
(void) | - performSelector:onThread:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. More... | |
(void) | - performSelector:onThread:withObject:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. More... | |
(void) | - performSelector:onThread:withObject:withObject:withObject:withObject:afterDelay: |
Performs the specified selector on the specified thread with the specified objects after the specified delay. More... | |
(nullable id) | - forwardingTargetForSelector: |
This method is called when resolveClassMethod: or resolveInstanceMethod: returned false. It should return a target to which the message should be forwarded. More... | |
(void) | - doesNotRecognizeSelector: |
Handles messages which are not understood by the receiver. More... | |
![]() | |
(unsigned long) | - hash |
Returns a 32 bit hash for the object. More... | |
(unsigned int) | - retainCount |
Returns the retain count. More... | |
(bool) | - isProxy |
Returns whether the object is a proxy object. More... | |
(bool) | - allowsWeakReference |
Returns whether the object allows weak references. More... | |
(bool) | - isKindOfClass: |
Returns a boolean whether the object of the specified kind. More... | |
(bool) | - isMemberOfClass: |
Returns a boolean whether the object is a member of the specified class. More... | |
(bool) | - respondsToSelector: |
Returns a boolean whether the object responds to the specified selector. More... | |
(nullable IMP) | - methodForSelector: |
Returns the implementation for the specified selector. More... | |
(nullable id) | - performSelector: |
Performs the specified selector. More... | |
(nullable id) | - performSelector:withObject: |
Performs the specified selector with the specified object. More... | |
(nullable id) | - performSelector:withObject:withObject: |
Performs the specified selector with the specified objects. More... | |
(nullable id) | - performSelector:withObject:withObject:withObject: |
Performs the specified selector with the specified objects. More... | |
(nullable id) | - performSelector:withObject:withObject:withObject:withObject: |
Performs the specified selector with the specified objects. More... | |
(bool) | - isEqual: |
Checks two objects for equality. More... | |
(instancetype) | - retain |
Increases the retain count. More... | |
(void) | - release |
Decreases the retain count. More... | |
(instancetype) | - autorelease |
Adds the object to the topmost autorelease pool of the thread's autorelease pool stack. More... | |
(instancetype) | - self |
Returns the receiver. More... | |
(bool) | - retainWeakReference |
Retain a weak reference to this object. More... | |
![]() | |
(id) | - copy |
Copies the object. More... | |
![]() | |
(id) | - mutableCopy |
Creates a mutable copy of the object. More... | |
![]() | |
(of_comparison_result_t) | - compare: |
Compares the object with another object. More... | |
![]() | |
(instancetype) | - initWithSerialization: |
Initializes the object with the specified XML element serialization. More... | |
![]() | |
(OFString *) | - JSONRepresentationWithOptions: |
Returns the JSON representation of the object as a string. More... | |
Class Methods | |
(instancetype) | + string |
Creates a new OFString. More... | |
(instancetype) | + stringWithUTF8String: |
Creates a new OFString from a UTF-8 encoded C string. More... | |
(instancetype) | + stringWithUTF8String:length: |
Creates a new OFString from a UTF-8 encoded C string with the specified length. More... | |
(instancetype) | + stringWithUTF8StringNoCopy:freeWhenDone: |
Creates a new OFString from a UTF-8 encoded C string without copying the string, if possible. More... | |
(instancetype) | + stringWithUTF8StringNoCopy:length:freeWhenDone: |
Creates a new OFString from a UTF-8 encoded C string with the specified length without copying the string, if possible. More... | |
(instancetype) | + stringWithCString:encoding: |
Creates a new OFString from a C string with the specified encoding. More... | |
(instancetype) | + stringWithCString:encoding:length: |
Creates a new OFString from a C string with the specified encoding and length. More... | |
(instancetype) | + stringWithData:encoding: |
Creates a new OFString from OFData with the specified encoding. More... | |
(instancetype) | + stringWithString: |
Creates a new OFString from another string. More... | |
(instancetype) | + stringWithCharacters:length: |
Creates a new OFString from a Unicode string with the specified length. More... | |
(instancetype) | + stringWithUTF16String: |
Creates a new OFString from a UTF-16 encoded string. More... | |
(instancetype) | + stringWithUTF16String:length: |
Creates a new OFString from a UTF-16 encoded string with the specified length. More... | |
(instancetype) | + stringWithUTF16String:byteOrder: |
Creates a new OFString from a UTF-16 encoded string, assuming the specified byte order if no byte order mark is found. More... | |
(instancetype) | + stringWithUTF16String:length:byteOrder: |
Creates a new OFString from a UTF-16 encoded string with the specified length, assuming the specified byte order if no byte order mark is found. More... | |
(instancetype) | + stringWithUTF32String: |
Creates a new OFString from a UTF-32 encoded string. More... | |
(instancetype) | + stringWithUTF32String:length: |
Creates a new OFString from a UTF-32 encoded string with the specified length. More... | |
(instancetype) | + stringWithUTF32String:byteOrder: |
Creates a new OFString from a UTF-32 encoded string, assuming the specified byte order if no byte order mark is found. More... | |
(instancetype) | + stringWithUTF32String:length:byteOrder: |
Creates a new OFString from a UTF-32 encoded string with the specified length, assuming the specified byte order if no byte order mark is found. More... | |
(instancetype) | + stringWithFormat: |
Creates a new OFString from a format string. More... | |
(instancetype) | + stringWithContentsOfFile: |
Creates a new OFString with the contents of the specified UTF-8 encoded file. More... | |
(instancetype) | + stringWithContentsOfFile:encoding: |
Creates a new OFString with the contents of the specified file in the specified encoding. More... | |
(instancetype) | + stringWithContentsOfURL: |
Creates a new OFString with the contents of the specified URL. More... | |
(instancetype) | + stringWithContentsOfURL:encoding: |
Creates a new OFString with the contents of the specified URL in the specified encoding. More... | |
(OFString *) | + pathWithComponents: |
Creates a path from the specified path components. More... | |
![]() | |
(void) | + load |
A method which is called once when the class is loaded into the runtime. More... | |
(void) | + unload |
A method which is called when the class is unloaded from the runtime. More... | |
(void) | + initialize |
A method which is called the moment before the first call to the class is being made. More... | |
(instancetype) | + alloc |
Allocates memory for an instance of the class and sets up the memory pool for the object. More... | |
(instancetype) | + new |
Calls alloc on self and then init on the returned object. More... | |
(Class) | + class |
Returns the class. More... | |
(OFString *) | + className |
Returns the name of the class as a string. More... | |
(bool) | + isSubclassOfClass: |
Returns a boolean whether the class is a subclass of the specified class. More... | |
(nullable Class) | + superclass |
Returns the superclass of the class. More... | |
(bool) | + instancesRespondToSelector: |
Checks whether instances of the class respond to a given selector. More... | |
(bool) | + conformsToProtocol: |
Checks whether the class conforms to a given protocol. More... | |
(nullable IMP) | + instanceMethodForSelector: |
Returns the implementation of the instance method for the specified selector. More... | |
(nullable OFMethodSignature *) | + instanceMethodSignatureForSelector: |
Returns the method signature of the instance method for the specified selector. More... | |
(OFString *) | + description |
Returns a description for the class, which is usually the class name. More... | |
(nullable IMP) | + replaceClassMethod:withMethodFromClass: |
Replaces a class method with a class method from another class. More... | |
(nullable IMP) | + replaceInstanceMethod:withMethodFromClass: |
Replaces an instance method with an instance method from another class. More... | |
(void) | + inheritMethodsFromClass: |
Adds all methods from the specified class to the class that is the receiver. More... | |
(bool) | + resolveClassMethod: |
Try to resolve the specified class method. More... | |
(bool) | + resolveInstanceMethod: |
Try to resolve the specified instance method. More... | |
(id) | + copy |
Returns the class. More... | |
Properties | |
size_t | length |
The length of the string in Unicode codepoints. | |
const char * | UTF8String |
The OFString as a UTF-8 encoded C string. More... | |
size_t | UTF8StringLength |
The number of bytes the string needs in UTF-8 encoding. | |
OFString * | uppercaseString |
The string in uppercase. | |
OFString * | lowercaseString |
The string in lowercase. | |
OFString * | capitalizedString |
The string in capitalized form. More... | |
long long | longLongValue |
The decimal value of the string as a long long . More... | |
unsigned long long | unsignedLongLongValue |
The decimal value of the string as an unsigned long long . More... | |
float | floatValue |
The float value of the string as a float. More... | |
double | doubleValue |
The double value of the string as a double. More... | |
const of_unichar_t * | characters |
The string as an array of Unicode characters. More... | |
const of_char16_t * | UTF16String |
The string in UTF-16 encoding with native byte order. More... | |
size_t | UTF16StringLength |
The length of the string in UTF-16 characters. | |
const of_char32_t * | UTF32String |
The string in UTF-32 encoding with native byte order. More... | |
OFString * | stringByDeletingLeadingWhitespaces |
The string with leading whitespaces deleted. | |
OFString * | stringByDeletingTrailingWhitespaces |
The string with trailing whitespaces deleted. | |
OFString * | stringByDeletingEnclosingWhitespaces |
The string with leading and trailing whitespaces deleted. | |
OFString * | decomposedStringWithCanonicalMapping |
The string in Unicode Normalization Form D (NFD). | |
OFString * | decomposedStringWithCompatibilityMapping |
The string in Unicode Normalization Form KD (NFKD). | |
OFString * | MD5Hash |
The MD5 hash of the string as a string. | |
OFString * | RIPEMD160Hash |
The RIPEMD-160 hash of the string as a string. | |
OFString * | SHA1Hash |
The SHA-1 hash of the string as a string. | |
OFString * | SHA224Hash |
The SHA-224 hash of the string as a string. | |
OFString * | SHA256Hash |
The SHA-256 hash of the string as a string. | |
OFString * | SHA384Hash |
The SHA-384 hash of the string as a string. | |
OFString * | SHA512Hash |
The SHA-512 hash of the string as a string. | |
id | objectByParsingJSON |
The string interpreted as JSON and parsed as an object. More... | |
bool | absolutePath |
Whether the path is an absolute path. | |
OFArray * | pathComponents |
The components of the string when interpreted as a path. | |
OFString * | lastPathComponent |
The last path component of the string when interpreted as a path. | |
OFString * | pathExtension |
The file extension of string when interpreted as a path. | |
OFString * | stringByDeletingLastPathComponent |
The directory name of the string when interpreted as a path. | |
OFString * | stringByDeletingPathExtension |
The string with the file extension of the path removed. | |
OFString * | stringByStandardizingPath |
The string interpreted as a path with relative sub paths resolved. | |
id | objectByParsingPropertyList |
The string interpreted as a property list and parsed as an object. More... | |
id | objectByDeserializing |
The string interpreted as serialization and parsed as an object. | |
OFString * | stringByURLDecoding |
The string as an URL decoded string. | |
OFString * | stringByXMLEscaping |
The string in a form escaped for use in an XML document. | |
OFString * | stringByXMLUnescaping |
The string with XML entities unescapted. | |
![]() | |
OFString * | className |
The name of the object's class. | |
OFString * | description |
A description for the object. More... | |
OFString * | stringBySerializing |
The object serialized as a string. | |
![]() | |
OFXMLElement * | XMLElementBySerializing |
The object serialized into an XML element. | |
![]() | |
OFString * | JSONRepresentation |
The JSON representation of the object as a string. | |
![]() | |
OFData * | messagePackRepresentation |
The MessagePack representation of the object as OFData. | |
A class for handling strings.
- (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 *) componentsSeparatedByCharactersInSet: | (OFCharacterSet *) | characterSet |
Separates the string into an array of strings, split by characters in the specified set.
characterSet | The character set for separating |
- (OFArray *) componentsSeparatedByCharactersInSet: | (OFCharacterSet *) | characterSet | |
options: | (int) | options | |
Separates the string into an array of strings, split by characters in the specified set.
characterSet | The character set for separating | ||||
options | Options according to which the string should be separated. Possible values are:
|
Separates the string into an array of strings, split by the specified delimiter.
delimiter | The delimiter for separating |
- (OFArray *) componentsSeparatedByString: | (OFString *) | delimiter | |
options: | (int) | options | |
Separates the string into an array of strings, split by the specified delimiter.
delimiter | The delimiter for separating | ||||
options | Options according to which the string should be separated. Possible values are:
|
- (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) | encoding |
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 |
- (OFData *) dataWithEncoding: | (of_string_encoding_t) | encoding |
- (void) enumerateLinesUsingBlock: | (of_string_line_enumeration_block_t) | block |
block The block to call for each line
Enumerates all lines in the receiver using the specified block.
- (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 |
- (size_t) getCString: | (char *) | cString | |
maxLength: | (size_t) | maxLength | |
encoding: | (of_string_encoding_t) | encoding | |
Writes the OFString into the specified C string with the specified encoding.
cString | The C string to write into |
maxLength | The maximum number of bytes to write into the C string, including the terminating zero |
encoding | The encoding to use for writing into the C string |
- (size_t) getLossyCString: | (char *) | cString | |
maxLength: | (size_t) | maxLength | |
encoding: | (of_string_encoding_t) | encoding | |
Writes the OFString into the specified C string with the specified encoding, replacing characters that cannot be represented in the specified encoding with a question mark.
cString | The C string to write into |
maxLength | The maximum number of bytes to write into the C string, including the terminating zero |
encoding | The encoding to use for writing into the C string |
- (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 |
- (size_t) indexOfCharacterFromSet: | (OFCharacterSet *) | characterSet |
Returns the index of the first character from the set.
characterSet | The set of characters to search for |
OF_NOT_FOUND
if it was not found - (size_t) indexOfCharacterFromSet: | (OFCharacterSet *) | characterSet | |
options: | (int) | options | |
Returns the index of the first character from the set.
characterSet | The set of characters to search for | ||||
options | Options modifying search behaviour. Possible values are:
|
OF_NOT_FOUND
if it was not found - (size_t) indexOfCharacterFromSet: | (OFCharacterSet *) | characterSet | |
options: | (int) | options | |
range: | (of_range_t) | range | |
Returns the index of the first character from the set.
characterSet | The set of characters to search for | ||||
options | Options modifying search behaviour. Possible values are:
| ||||
range | The range in which to search |
OF_NOT_FOUND
if it was not found - (instancetype) initWithCharacters: | (const of_unichar_t *) | characters | |
length: | (size_t) | length | |
- (instancetype) initWithContentsOfFile: | (OFString *) | path |
- (instancetype) initWithContentsOfFile: | (OFString *) | path | |
encoding: | (of_string_encoding_t) | encoding | |
- (instancetype) 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 |
- (instancetype) initWithContentsOfURL: | (OFURL *) | URL | |
encoding: | (of_string_encoding_t) | encoding | |
- (instancetype) initWithCString: | (const char *) | cString | |
encoding: | (of_string_encoding_t) | encoding | |
- (instancetype) initWithCString: | (const char *) | cString | |
encoding: | (of_string_encoding_t) | encoding | |
length: | (size_t) | cStringLength | |
- (instancetype) initWithData: | (OFData *) | data | |
encoding: | (of_string_encoding_t) | encoding | |
- (instancetype) initWithFormat: | (OFConstantString *) | format | |
, | ... | ||
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, C
for of_unichar_t
and S
for const of_unichar_t *
.
format | A string used as format to initialize the OFString |
- (instancetype) 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, C
for of_unichar_t
and S
for const of_unichar_t *
.
format | A string used as format to initialize the OFString |
arguments | The arguments used in the format string |
- (instancetype) initWithString: | (OFString *) | string |
- (instancetype) initWithUTF16String: | (const of_char16_t *) | string |
- (instancetype) initWithUTF16String: | (const of_char16_t *) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
- (instancetype) initWithUTF16String: | (const of_char16_t *) | string | |
length: | (size_t) | length | |
- (instancetype) initWithUTF16String: | (const of_char16_t *) | string | |
length: | (size_t) | length | |
byteOrder: | (of_byte_order_t) | byteOrder | |
Initializes an already allocated OFString with a UTF-16 string with the specified length, assuming the specified byte order if no byte order mark is found.
string | The UTF-16 string |
length | The length of the UTF-16 string |
byteOrder | The byte order to assume if there is no byte order mark |
- (instancetype) initWithUTF32String: | (const of_char32_t *) | string |
- (instancetype) initWithUTF32String: | (const of_char32_t *) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
- (instancetype) initWithUTF32String: | (const of_char32_t *) | string | |
length: | (size_t) | length | |
- (instancetype) initWithUTF32String: | (const of_char32_t *) | string | |
length: | (size_t) | length | |
byteOrder: | (of_byte_order_t) | byteOrder | |
Initializes an already allocated OFString with a UTF-32 string with the specified length, assuming the specified byte order if no byte order mark is found.
string | The UTF-32 string |
length | The length of the UTF-32 string |
byteOrder | The byte order to assume if there is no byte order mark |
- (instancetype) initWithUTF8String: | (const char *) | UTF8String |
- (instancetype) initWithUTF8String: | (const char *) | UTF8String | |
length: | (size_t) | UTF8StringLength | |
- (instancetype) initWithUTF8StringNoCopy: | (char *) | UTF8String | |
freeWhenDone: | (bool) | freeWhenDone | |
Initializes an already allocated OFString from an UTF-8 encoded C string without copying the string, if possible.
If initialization fails for whatever reason, the passed C string is free'd if freeWhenDone
is true.
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 |
- (instancetype) initWithUTF8StringNoCopy: | (char *) | UTF8String | |
length: | (size_t) | UTF8StringLength | |
freeWhenDone: | (bool) | freeWhenDone | |
Initializes an already allocated OFString from an UTF-8 encoded C string with the specified length without copying the string, if possible.
If initialization fails for whatever reason, the passed C string is free'd if freeWhenDone
is true.
UTF8String | A UTF-8 encoded C string to initialize the OFString with |
UTF8StringLength | The length of the UTF-8 encoded C string |
freeWhenDone | Whether to free the C string when it is not needed anymore |
- (long long) longLongValueWithBase: | (int) | base |
The value of the string in the specified base as a long long
.
Leading and trailing whitespaces are ignored.
If the string contains any non-number characters, an OFInvalidFormatException is thrown.
If the number is too big to fit into a long long
, an OFOutOfRangeException is thrown.
base | The base to use. If the base is 0, base 16 is assumed if the string starts with 0x (after stripping white spaces). If the string starts with 0, base 8 is assumed. Otherwise, base 10 is assumed. |
- (const char *) lossyCStringWithEncoding: | (of_string_encoding_t) | encoding |
Returns the OFString as a C string in the specified encoding, replacing characters that cannot be represented in the specified encoding with a question mark.
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 |
- (id) objectByParsingJSONWithDepthLimit: | (size_t) | depthLimit |
Creates an object from the JSON value of the string.
depthLimit | The maximum depth the parser should accept (defaults to 32 if not specified, 0 means no limit (insecure!)) |
Creates a path from the specified path components.
components | An array of components for the path |
- (of_range_t) rangeOfString: | (OFString *) | string |
Returns the range of the first occurrence of the string.
string | The string to search |
OF_NOT_FOUND
as start position if it was not found - (of_range_t) rangeOfString: | (OFString *) | string | |
options: | (int) | options | |
Returns the range of the string.
string | The string to search | ||||
options | Options modifying search behavior. Possible values are:
|
OF_NOT_FOUND
as start position if it was not found - (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 are:
| ||||
range | The range in which to search |
OF_NOT_FOUND
as start position if it was not found - (OFString *) stringByAppendingFormat: | (OFConstantString *) | format | |
, | ... | ||
Creates a new string by appending the specified format.
format | A format string which generates the string to append |
- (OFString *) stringByAppendingFormat: | (OFConstantString *) | format | |
arguments: | (va_list) | arguments | |
Creates a new string by appending the specified format.
format | A format string which generates the string to append |
arguments | The arguments used in the format string |
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 |
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 are:
|
range | The range in which to replace the string |
- (OFString *) stringByURLEncodingWithAllowedCharacters: | (OFCharacterSet *) | allowedCharacters |
Encodes a string for use in a URL, but does not escape the specified allowed characters.
allowedCharacters | A character set of characters that should not be escaped |
- (OFString *) stringByXMLUnescapingWithBlock: | (of_string_xml_unescaping_block_t) | block |
Unescapes XML in the string and uses the specified block for unknown entities.
block | A block which handles unknown entities |
- (OFString *) stringByXMLUnescapingWithDelegate: | (nullable 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 |
+ (instancetype) stringWithCharacters: | (const of_unichar_t *) | characters | |
length: | (size_t) | length | |
+ (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) stringWithData: | (OFData *) | data | |
encoding: | (of_string_encoding_t) | encoding | |
+ (instancetype) stringWithFormat: | (OFConstantString *) | format | |
, | ... | ||
+ (instancetype) stringWithString: | (OFString *) | string |
+ (instancetype) stringWithUTF16String: | (const of_char16_t *) | string |
+ (instancetype) stringWithUTF16String: | (const of_char16_t *) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
+ (instancetype) stringWithUTF16String: | (const of_char16_t *) | string | |
length: | (size_t) | length | |
+ (instancetype) stringWithUTF16String: | (const of_char16_t *) | string | |
length: | (size_t) | length | |
byteOrder: | (of_byte_order_t) | byteOrder | |
Creates a new OFString from a UTF-16 encoded string with the specified length, assuming the specified byte order if no byte order mark is found.
string | The UTF-16 string |
length | The length of the UTF-16 string |
byteOrder | The byte order to assume if there is no byte order mark |
+ (instancetype) stringWithUTF32String: | (const of_char32_t *) | string |
+ (instancetype) stringWithUTF32String: | (const of_char32_t *) | string | |
byteOrder: | (of_byte_order_t) | byteOrder | |
+ (instancetype) stringWithUTF32String: | (const of_char32_t *) | string | |
length: | (size_t) | length | |
+ (instancetype) stringWithUTF32String: | (const of_char32_t *) | string | |
length: | (size_t) | length | |
byteOrder: | (of_byte_order_t) | byteOrder | |
Creates a new OFString from a UTF-32 encoded string with the specified length, assuming the specified byte order if no byte order mark is found.
string | The UTF-32 string |
length | The length of the UTF-32 string |
byteOrder | The byte order to assume if there is no byte order mark |
+ (instancetype) stringWithUTF8String: | (const char *) | UTF8String |
+ (instancetype) stringWithUTF8String: | (const char *) | UTF8String | |
length: | (size_t) | UTF8StringLength | |
+ (instancetype) stringWithUTF8StringNoCopy: | (char *) | UTF8String | |
freeWhenDone: | (bool) | freeWhenDone | |
Creates a new OFString from a UTF-8 encoded C string without copying the string, if possible.
If initialization fails for whatever reason, the passed C string is free'd if freeWhenDone
is true.
UTF8String | A UTF-8 encoded C string to initialize the OFString with |
freeWhenDone | Whether to free the C string when the OFString gets deallocated |
+ (instancetype) stringWithUTF8StringNoCopy: | (char *) | UTF8String | |
length: | (size_t) | UTF8StringLength | |
freeWhenDone: | (bool) | freeWhenDone | |
Creates a new OFString from a UTF-8 encoded C string with the specified length without copying the string, if possible.
If initialization fails for whatever reason, the passed C string is free'd if freeWhenDone
is true.
UTF8String | A UTF-8 encoded C string to initialize the OFString with |
UTF8StringLength | The length of the UTF-8 encoded C string |
freeWhenDone | Whether to free the C string when the OFString gets deallocated |
- (OFString *) substringFromIndex: | (size_t) | idx |
Creates a substring from the specified index to the end.
idx | The index from where the substring should start, inclusive |
- (OFString *) substringToIndex: | (size_t) | idx |
Creates a substring from the beginning to the specified index.
idx | The index at which the substring should end, exclusive |
- (OFString *) substringWithRange: | (of_range_t) | range |
Creates a substring with the specified range.
range | The range of the substring |
- (unsigned long long) unsignedLongLongValueWithBase: | (int) | base |
The value of the string in the specified base as an unsigned long long
.
Leading and trailing whitespaces are ignored.
If the string contains any non-number characters, an OFInvalidFormatException is thrown.
If the number is too big to fit into an unsigned long long
, an OFOutOfRangeException is thrown.
base | The base to use. If the base is 0, base 16 is assumed if the string starts with 0x (after stripping white spaces). If the string starts with 0, base 8 is assumed. Otherwise, base 10 is assumed. |
- (const of_char16_t *) UTF16StringWithByteOrder: | (of_byte_order_t) | byteOrder |
Returns the string in UTF-16 encoding with the specified byte order.
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.
byteOrder | The byte order for the UTF-16 encoding |
- (const of_char32_t *) UTF32StringWithByteOrder: | (of_byte_order_t) | byteOrder |
Returns the string in UTF-32 encoding with the specified byte order.
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.
byteOrder | The byte order for the UTF-32 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 |
- (void) writeToFile: | (OFString *) | path | |
encoding: | (of_string_encoding_t) | encoding | |
Writes the string into the specified file using the specified encoding.
path | The path of the file to write to |
encoding | The encoding to use to write the string into the file |
- (void) writeToURL: | (OFURL *) | URL |
Writes the string to the specified URL using UTF-8 encoding.
URL | The URL to write to |
- (void) writeToURL: | (OFURL *) | URL | |
encoding: | (of_string_encoding_t) | encoding | |
Writes the string to the specified URL using the specified encoding.
URL | The URL to write to |
encoding | The encoding to use to write the string to the URL |
|
readnonatomicassign |
The string in capitalized form.
|
readnonatomicassign |
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.
|
readnonatomicassign |
The double value of the string as a double.
If the string contains any non-number characters, an OFInvalidFormatException is thrown.
|
readnonatomicassign |
The float value of the string as a float.
If the string contains any non-number characters, an OFInvalidFormatException is thrown.
|
readnonatomicassign |
The decimal value of the string as a long long
.
Leading and trailing whitespaces are ignored.
If the string contains any non-number characters, an OFInvalidFormatException is thrown.
If the number is too big to fit into a long long
, an OFOutOfRangeException is thrown.
|
readnonatomicassign |
The string interpreted as JSON and parsed as an object.
|
readnonatomicassign |
The string interpreted as a property list and parsed as an object.
|
readnonatomicassign |
The decimal value of the string as an unsigned long long
.
Leading and trailing whitespaces are ignored.
If the string contains any non-number characters, an OFInvalidFormatException is thrown.
If the number is too big to fit into an unsigned long long
, an OFOutOfRangeException is thrown.
|
readnonatomicassign |
The string in UTF-16 encoding with native byte order.
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.
|
readnonatomicassign |
The string in UTF-32 encoding with native byte order.
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.
|
readnonatomicassign |
The OFString as a UTF-8 encoded C string.
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.