ObjFW
Public Member Functions | Static Public Member Functions
OFString Class Reference

A class for handling strings. More...

#import <OFString.h>

Inheritance diagram for OFString:
OFObject <OFCopying> <OFMutableCopying> <OFComparing> <OFSerialization> <OFJSON> <OFObject> <OFObject> OFConstantString OFMutableString

List of all members.

Public Member Functions

(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) - 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 *) - UTF8String
 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.
(size_t) - indexOfFirstOccurrenceOfString:
 Returns the index of the first occurrence of the string.
(size_t) - indexOfLastOccurrenceOfString:
 Returns the index of the last occurrence of the string.
(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 *) - 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:inRange:
 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 *) - 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:
 Splits 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 *) - unicodeString
 Returns the string as an array of Unicode characters.
(const uint16_t *) - UTF16String
 Returns the string in big endian UTF-16 encoding.
(void) - writeToFile:
 Writes the string into the specified file using UTF-8 encoding.
(void) - enumerateLinesUsingBlock:
 block The block to call for each line
(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.
(OFString *) - stringByXMLUnescapingWithBlock:
 Unescapes XML in the string and uses the specified block for unknown entities.

Static Public Member Functions

(id) + string
 Creates a new OFString.
(id) + stringWithUTF8String:
 Creates a new OFString from a UTF-8 encoded C string.
(id) + stringWithUTF8String:length:
 Creates a new OFString from a UTF-8 encoded C string with the specified length.
(id) + stringWithCString:encoding:
 Creates a new OFString from a C string with the specified encoding.
(id) + stringWithCString:encoding:length:
 Creates a new OFString from a C string with the specified encoding and length.
(id) + stringWithString:
 Creates a new OFString from another string.
(id) + stringWithUnicodeString:
 Creates a new OFString from a unicode string.
(id) + stringWithUnicodeString:byteOrder:
 Creates a new OFString from a unicode string, assuming the specified byte order if no BOM is found.
(id) + stringWithUnicodeString:length:
 Creates a new OFString from a unicode string with the specified length.
(id) + 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.
(id) + stringWithUTF16String:
 Creates a new OFString from a UTF-16 encoded string.
(id) + stringWithUTF16String:byteOrder:
 Creates a new OFString from a UTF-16 encoded string, assuming the specified byte order if no BOM is found.
(id) + stringWithUTF16String:length:
 Creates a new OFString from a UTF-16 encoded string with the specified length.
(id) + 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.
(id) + stringWithFormat:
 Creates a new OFString from a format string.
(id) + stringWithPath:
 Creates a new OFString containing the constructed specified path.
(id) + stringWithContentsOfFile:
 Creates a new OFString with the contents of the specified UTF-8 encoded file.
(id) + stringWithContentsOfFile:encoding:
 Creates a new OFString with the contents of the specified file in the specified encoding.
(id) + stringWithContentsOfURL:
 Creates a new OFString with the contents of the specified URL.
(id) + stringWithContentsOfURL:encoding:
 Creates a new OFString with the contents of the specified URL in the specified encoding.

Detailed Description

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.


Member Function Documentation

- (of_comparison_result_t) caseInsensitiveCompare: (OFString*)  otherString

Compares the OFString to another OFString without caring about the case.

Parameters:
otherStringA string to compare with
Returns:
An of_comparison_result_t
- (of_unichar_t) characterAtIndex: (size_t)  index

Returns the Unicode character at the specified index.

Parameters:
indexThe index of the Unicode character to return
Returns:
The Unicode character at the specified index
- (OFArray *) componentsSeparatedByString: (OFString*)  delimiter

Splits an OFString into an OFArray of OFStrings.

Parameters:
delimiterThe delimiter for splitting
Returns:
An autoreleased OFArray with the split string
- (BOOL) containsString: (OFString*)  string

Returns whether the string contains the specified string.

Parameters:
stringThe string to search
Returns:
Whether the string contains the specified string
- (size_t) cStringLengthWithEncoding: (of_string_encoding_t)  encoding

Returns the number of bytes the string needs in the specified encoding.

Parameters:
encodingThe encoding for the string
Returns:
The number of bytes the string needs in the specified encoding.
- (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.

Parameters:
encodingThe encoding for the C string
Returns:
The OFString as a C string in the specified encoding
- (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.

Returns:
An intmax_t with the value of the string
- (double) doubleValue

Returns the double value of the string as a double.

If the string contains any non-number characters, an OFInvalidEncodingException is thrown.

Returns:
A double with the value of the string
- (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.

- (float) floatValue

Returns the float value of the string as a float.

If the string contains any non-number characters, an OFInvalidEncodingException is thrown.

Returns:
A float with the value of the string
- (void) getCharacters: (of_unichar_t*)  buffer
inRange: (of_range_t range 

Copies the Unicode characters in the specified range to the specified buffer.

Parameters:
bufferThe buffer to store the Unicode characters
rangeThe range of the Unicode characters to copy
- (BOOL) hasPrefix: (OFString*)  prefix

Checks whether the string has the specified prefix.

Parameters:
prefixThe prefix to check for
Returns:
A boolean whether the string has the specified prefix
- (BOOL) hasSuffix: (OFString*)  suffix

Checks whether the string has the specified suffix.

Parameters:
suffixThe suffix to check for
Returns:
A boolean whether the string has the specified suffix
- (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.

Returns:
A uintmax_t with the value of the string
- (size_t) indexOfFirstOccurrenceOfString: (OFString*)  string

Returns the index of the first occurrence of the string.

Parameters:
stringThe string to search
Returns:
The index of the first occurrence of the string or OF_INVALID_INDEX if it was not found
- (size_t) indexOfLastOccurrenceOfString: (OFString*)  string

Returns the index of the last occurrence of the string.

Parameters:
stringThe string to search
Returns:
The index of the last occurrence of the string or OF_INVALID_INDEX if it was not found
- (id) initWithContentsOfFile: (OFString*)  path

Initializes an already allocated OFString with the contents of the specified file in the specified encoding.

Parameters:
pathThe path to the file
Returns:
An initialized OFString
- (id) initWithContentsOfFile: (OFString*)  path
encoding: (of_string_encoding_t)  encoding 

Initializes an already allocated OFString with the contents of the specified file in the specified encoding.

Parameters:
pathThe path to the file
encodingThe encoding of the file
Returns:
An initialized OFString
- (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.

Parameters:
URLThe URL to the contents for the string
Returns:
An initialized OFString
- (id) initWithContentsOfURL: (OFURL*)  URL
encoding: (of_string_encoding_t)  encoding 

Initializes an already allocated OFString with the contents of the specified URL in the specified encoding.

Parameters:
URLThe URL to the contents for the string
encodingThe encoding to assume
Returns:
An initialized OFString
- (id) initWithCString: (const char*)  cString
encoding: (of_string_encoding_t)  encoding 

Initializes an already allocated OFString from a C string with the specified encoding.

Parameters:
cStringA C string to initialize the OFString with
encodingThe encoding of the C string
Returns:
An initialized OFString
- (id) initWithCString: (const char*)  cString
encoding: (of_string_encoding_t)  encoding
length: (size_t)  cStringLength 

Initializes an already allocated OFString from a C string with the specified encoding and length.

Parameters:
cStringA C string to initialize the OFString with
encodingThe encoding of the C string
cStringLengthThe length of the C string
Returns:
An initialized OFString
- (id) 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.

Parameters:
formatA string used as format to initialize the OFString
Returns:
An initialized OFString
- (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.

Parameters:
formatA string used as format to initialize the OFString
argumentsThe arguments used in the format string
Returns:
An initialized OFString
- (id) initWithPath: (OFString*)  firstComponent
,   ... 

Initializes an already allocated OFString with the constructed specified path.

Parameters:
firstComponentThe first component of the path
Returns:
A new autoreleased OFString
- (id) initWithPath: (OFString*)  firstComponent
arguments: (va_list)  arguments 

Initializes an already allocated OFString with the constructed specified path.

Parameters:
firstComponentThe first component of the path
argumentsA va_list with the other components of the path
Returns:
A new autoreleased OFString
- (id) initWithString: (OFString*)  string

Initializes an already allocated OFString with another string.

Parameters:
stringA string to initialize the OFString with
Returns:
An initialized OFString
- (id) initWithUnicodeString: (const of_unichar_t*)  string

Initializes an already allocated OFString with a unicode string.

Parameters:
stringThe unicode string
Returns:
An initialized OFString
- (id) initWithUnicodeString: (const of_unichar_t*)  string
byteOrder: (of_endianess_t)  byteOrder 

Initializes an already allocated OFString with a unicode string, assuming the specified byte order if no BOM is found.

Parameters:
stringThe unicode string
byteOrderThe byte order to assume if there is no BOM
Returns:
An initialized OFString
- (id) initWithUnicodeString: (const of_unichar_t*)  string
byteOrder: (of_endianess_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.

Parameters:
stringThe unicode string
byteOrderThe byte order to assume if there is no BOM
lengthThe length of the unicode string
Returns:
An initialized OFString
- (id) initWithUnicodeString: (const of_unichar_t*)  string
length: (size_t)  length 

Initializes an already allocated OFString with a unicode string with the specified length.

Parameters:
stringThe unicode string
lengthThe length of the unicode string
Returns:
An initialized OFString
- (id) initWithUTF16String: (const uint16_t*)  string

Initializes an already allocated OFString with a UTF-16 string.

Parameters:
stringThe UTF-16 string
Returns:
An initialized OFString
- (id) initWithUTF16String: (const uint16_t*)  string
byteOrder: (of_endianess_t)  byteOrder 

Initializes an already allocated OFString with a UTF-16 string, assuming the specified byte order if no BOM is found.

Parameters:
stringThe UTF-16 string
byteOrderThe byte order to assume if there is no BOM
Returns:
An initialized OFString
- (id) initWithUTF16String: (const uint16_t*)  string
byteOrder: (of_endianess_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.

Parameters:
stringThe UTF-16 string
byteOrderThe byte order to assume if there is no BOM
lengthThe length of the UTF-16 string
Returns:
An initialized OFString
- (id) initWithUTF16String: (const uint16_t*)  string
length: (size_t)  length 

Initializes an already allocated OFString with a UTF-16 string with the specified length.

Parameters:
stringThe UTF-16 string
lengthThe length of the UTF-16 string
Returns:
An initialized OFString
- (id) initWithUTF8String: (const char*)  UTF8String

Initializes an already allocated OFString from a UTF-8 encoded C string.

Parameters:
UTF8StringA UTF-8 encoded C string to initialize the OFString with
Returns:
An initialized OFString
- (id) initWithUTF8String: (const char*)  UTF8String
length: (size_t)  UTF8StringLength 

Initializes an already allocated OFString from a UTF-8 encoded C string with the specified length.

Parameters:
UTF8StringA UTF-8 encoded C string to initialize the OFString with
UTF8StringLengthThe length of the UTF-8 encoded C string
Returns:
An initialized OFString
- (id) JSONValue

Creates an object from the JSON value of the string.

Returns:
An object
- (OFString *) lastPathComponent

Returns the last component of the path.

Returns:
The last component of the path
- (size_t) length

Returns the length of the string in Unicode characters.

Returns:
The length of the string in Unicode characters
- (OFString *) lowercaseString

Returns the string in lowercase.

Returns:
The string in lowercase
- (OFString*) MD5Hash

Returns the MD5 hash of the string as an autoreleased OFString.

Returns:
The MD5 hash of the string as an autoreleased OFString
- (id) objectByDeserializing

Deserializes the receiver into an object.

Returns:
The deserialized object
- (OFArray *) pathComponents

Returns the components of the path.

Returns:
The components of the path
- (OFString*) SHA1Hash

Returns the SHA1 hash of the string as an autoreleased OFString.

Returns:
The SHA1 hash of the string as an autoreleased OFString
+ (id) string

Creates a new OFString.

Returns:
A new, autoreleased OFString
- (OFString *) stringByAppendingString: (OFString*)  string

Creates a new string by appending another string.

Parameters:
stringThe string to append
Returns:
A new autoreleased OFString with the specified string appended
- (OFString *) stringByDeletingEnclosingWhitespaces

Creates a new string by deleting leading and trailing whitespaces.

Returns:
A new autoreleased OFString with leading and trailing whitespaces deleted
- (OFString *) stringByDeletingLastPathComponent

Returns the directory name of the path.

Returns:
The directory name of the path
- (OFString *) stringByDeletingLeadingWhitespaces

Creates a new string by deleting leading whitespaces.

Returns:
A new autoreleased OFString with leading whitespaces deleted
- (OFString *) stringByDeletingTrailingWhitespaces

Creates a new string by deleting trailing whitespaces.

Returns:
A new autoreleased OFString with trailing whitespaces deleted
- (OFString *) stringByPrependingString: (OFString*)  string

Creates a new string by prepending another string.

Parameters:
stringThe string to prepend
Returns:
A new autoreleased OFString with the specified string prepended
- (OFString *) stringByReplacingOccurrencesOfString: (OFString*)  string
withString: (OFString*)  replacement 

Creates a new string by replacing the occurrences of the specified string with the specified replacement.

Parameters:
stringThe string to replace
replacementThe string with which it should be replaced
Returns:
A new string with the occurrences of the specified string replaced
- (OFString *) stringByReplacingOccurrencesOfString: (OFString*)  string
withString: (OFString*)  replacement
inRange: (of_range_t range 

Creates a new string by replacing the occurrences of the specified string in the specified range with the specified replacement.

Parameters:
stringThe string to replace
replacementThe string with which it should be replaced
rangeThe range in which to replace the string
Returns:
A new string with the occurrences of the specified string replaced
- (OFString*) stringByURLDecoding

Decodes a string used in a URL.

Returns:
A new autoreleased string
- (OFString*) stringByURLEncoding

Encodes a string for use in a URL.

Returns:
A new autoreleased string
- (OFString*) stringByXMLEscaping

Escapes a string for use in an XML document.

Returns:
A new autoreleased string
- (OFString*) stringByXMLUnescapingWithBlock: (of_string_xml_unescaping_block_t)  block

Unescapes XML in the string and uses the specified block for unknown entities.

Parameters:
blockA block which handles unknown entities
- (OFString*) stringByXMLUnescapingWithDelegate: (id< OFStringXMLUnescapingDelegate >)  delegate

Unescapes XML in the string and uses the specified delegate for unknown entities.

Parameters:
delegateAn OFXMLUnescapingDelegate as a handler for unknown entities
+ (id) stringWithContentsOfFile: (OFString*)  path

Creates a new OFString with the contents of the specified UTF-8 encoded file.

Parameters:
pathThe path to the file
Returns:
A new autoreleased OFString
+ (id) stringWithContentsOfFile: (OFString*)  path
encoding: (of_string_encoding_t)  encoding 

Creates a new OFString with the contents of the specified file in the specified encoding.

Parameters:
pathThe path to the file
encodingThe encoding of the file
Returns:
A new autoreleased OFString
+ (id) 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.

Parameters:
URLThe URL to the contents for the string
Returns:
A new autoreleased OFString
+ (id) stringWithContentsOfURL: (OFURL*)  URL
encoding: (of_string_encoding_t)  encoding 

Creates a new OFString with the contents of the specified URL in the specified encoding.

Parameters:
URLThe URL to the contents for the string
encodingThe encoding to assume
Returns:
A new autoreleased OFString
+ (id) stringWithCString: (const char*)  cString
encoding: (of_string_encoding_t)  encoding 

Creates a new OFString from a C string with the specified encoding.

Parameters:
stringA C string to initialize the OFString with
encodingThe encoding of the C string
Returns:
A new autoreleased OFString
+ (id) stringWithCString: (const char*)  cString
encoding: (of_string_encoding_t)  encoding
length: (size_t)  cStringLength 

Creates a new OFString from a C string with the specified encoding and length.

Parameters:
cStringA C string to initialize the OFString with
encodingThe encoding of the C string
cStringLengthThe length of the C string
Returns:
A new autoreleased OFString
+ (id) stringWithFormat: (OFConstantString*)  format
,   ... 

Creates a new OFString from a format string.

See printf for the format syntax. As an addition, %@ is available as format specifier for objects.

Parameters:
formatA string used as format to initialize the OFString
Returns:
A new autoreleased OFString
+ (id) stringWithPath: (OFString*)  firstComponent
,   ... 

Creates a new OFString containing the constructed specified path.

Parameters:
firstComponentThe first component of the path
Returns:
A new autoreleased OFString
+ (id) stringWithString: (OFString*)  string

Creates a new OFString from another string.

Parameters:
stringA string to initialize the OFString with
Returns:
A new autoreleased OFString
+ (id) stringWithUnicodeString: (const of_unichar_t*)  string

Creates a new OFString from a unicode string.

Parameters:
stringThe unicode string
Returns:
A new autoreleased OFString
+ (id) stringWithUnicodeString: (const of_unichar_t*)  string
byteOrder: (of_endianess_t)  byteOrder 

Creates a new OFString from a unicode string, assuming the specified byte order if no BOM is found.

Parameters:
stringThe unicode string
byteOrderThe byte order to assume if there is no BOM
Returns:
A new autoreleased OFString
+ (id) stringWithUnicodeString: (const of_unichar_t*)  string
byteOrder: (of_endianess_t)  byteOrder
length: (size_t)  length 

Creates a new OFString from a unicode string with the specified length, assuming the specified byte order if no BOM is found.

Parameters:
stringThe unicode string
byteOrderThe byte order to assume if there is no BOM
lengthThe length of the unicode string
Returns:
A new autoreleased OFString
+ (id) stringWithUnicodeString: (const of_unichar_t*)  string
length: (size_t)  length 

Creates a new OFString from a unicode string with the specified length.

Parameters:
stringThe unicode string
lengthThe length of the unicode string
Returns:
A new autoreleased OFString
+ (id) stringWithUTF16String: (const uint16_t*)  string

Creates a new OFString from a UTF-16 encoded string.

Parameters:
stringThe UTF-16 string
Returns:
A new autoreleased OFString
+ (id) stringWithUTF16String: (const uint16_t*)  string
byteOrder: (of_endianess_t)  byteOrder 

Creates a new OFString from a UTF-16 encoded string, assuming the specified byte order if no BOM is found.

Parameters:
stringThe UTF-16 string
byteOrderThe byte order to assume if there is no BOM
Returns:
A new autoreleased OFString
+ (id) stringWithUTF16String: (const uint16_t*)  string
byteOrder: (of_endianess_t)  byteOrder
length: (size_t)  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.

Parameters:
stringThe UTF-16 string
byteOrderThe byte order to assume if there is no BOM
lengthThe length of the unicode string
Returns:
A new autoreleased OFString
+ (id) stringWithUTF16String: (const uint16_t*)  string
length: (size_t)  length 

Creates a new OFString from a UTF-16 encoded string with the specified length.

Parameters:
stringThe UTF-16 string
lengthThe length of the unicode string
Returns:
A new autoreleased OFString
+ (id) stringWithUTF8String: (const char*)  UTF8String

Creates a new OFString from a UTF-8 encoded C string.

Parameters:
UTF8StringA UTF-8 encoded C string to initialize the OFString with
Returns:
A new autoreleased OFString
+ (id) stringWithUTF8String: (const char*)  UTF8String
length: (size_t)  UTF8StringLength 

Creates a new OFString from a UTF-8 encoded C string with the specified length.

Parameters:
UTF8StringA UTF-8 encoded C string to initialize the OFString with
UTF8StringLengthThe length of the UTF-8 encoded C string
Returns:
A new autoreleased OFString
- (OFString *) substringWithRange: (of_range_t range

Creates a substring with the specified range.

Parameters:
rangeThe range of the substring
Returns:
The substring as a new autoreleased OFString
- (const of_unichar_t *) unicodeString

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.

Returns:
The string as an array of Unicode characters
- (OFString *) uppercaseString

Returns the string in uppercase.

Returns:
The string in uppercase
- (const uint16_t *) UTF16String

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.

Returns:
The string in big endian UTF-16 encoding
- (const char *) UTF8String

Returns 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.

Returns:
The OFString as a UTF-8 encoded C string
- (size_t) UTF8StringLength

Returns the number of bytes the string needs in UTF-8 encoding.

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.

Parameters:
pathThe path of the file to write to

The documentation for this class was generated from the following files:
 All Classes Functions Variables Properties