OFString Class Reference

A class for handling strings. More...

#import <OFString.h>

Inheritance diagram for OFString:
OFObject <OFCopying> <OFMutableCopying> OFConstString OFMutableString

List of all members.

Public Member Functions

(id) - init
(id) - initWithCString:
(id) - initWithCString:encoding:
(id) - initWithCString:encoding:length:
(id) - initWithCString:length:
(id) - initWithFormat:
(id) - initWithFormat:arguments:
(id) - initWithString:
(const char *) - cString
(size_t) - length
(size_t) - cStringLength
(of_comparison_result_t) - compare:
(of_comparison_result_t) - caseInsensitiveCompare:
(of_unichar_t) - characterAtIndex:
(size_t) - indexOfFirstOccurrenceOfString:
(size_t) - indexOfLastOccurrenceOfString:
(OFString *) - substringFromIndex:toIndex:
(OFString *) - stringByAppendingString:
(BOOL) - hasPrefix:
(BOOL) - hasSuffix:
(OFArray *) - splitWithDelimiter:
(intmax_t) - decimalValueAsInteger
(intmax_t) - hexadecimalValueAsInteger
(OFString *) - md5Hash
(OFString *) - sha1Hash
(OFString *) - stringByURLEncoding
(OFString *) - stringByURLDecoding
(id) - stringByXMLEscaping
(id) - stringByXMLUnescaping
(id) - stringByXMLUnescapingWithHandler:

Static Public Member Functions

(id) + string
(id) + stringWithCString:
(id) + stringWithCString:encoding:
(id) + stringWithCString:encoding:length:
(id) + stringWithCString:length:
(id) + stringWithFormat:
(id) + stringWithString:

Protected Attributes

char * string
unsigned int length
BOOL is_utf8

Detailed Description

A class for handling strings.


Member Function Documentation

- (of_comparison_result_t) caseInsensitiveCompare: (OFString*)  str  

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

Parameters:
str A string to compare with
Returns:
An of_comparison_result_t
- (of_unichar_t) characterAtIndex: (size_t)  index  
Parameters:
index The index of the Unicode character to return
Returns:
The Unicode character at the specified index
- (of_comparison_result_t) compare: (OFString*)  str  

Compares the OFString to another OFString.

Parameters:
str A string to compare with
Returns:
An of_comparison_result_t
- (const char *) cString  
Returns:
The OFString as a UTF-8 encoded C string
- (size_t) cStringLength  
Returns:
The length of the string which cString would return
- (intmax_t) decimalValueAsInteger  

Returns the decimal value of the string as an intmax_t or throws an OFInvalidEncoding exception if the string contains any non-number characters.

Returns:
An OFNumber
- (BOOL) hasPrefix: (OFString*)  prefix  

Checks whether the string has the specified prefix.

Parameters:
prefix The 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:
suffix The suffix to check for
Returns:
A boolean whether the string has the specified suffix
- (intmax_t) hexadecimalValueAsInteger  

Returns the hexadecimal value of the string as an intmax_t or throws an OFInvalidEncoding exception if the string contains any non-number characters.

Returns:
An OFNumber
- (size_t) indexOfFirstOccurrenceOfString: (OFString*)  str  
Parameters:
str The string to search
Returns:
The index of the first occurrence of the string or SIZE_MAX if it wasn't found
- (size_t) indexOfLastOccurrenceOfString: (OFString*)  str  
Parameters:
str The string to search
Returns:
The index of the last occurrence of the string or SIZE_MAX if it wasn't found
- (id) init  

Initializes an already allocated OFString.

Returns:
An initialized OFString

Reimplemented from OFObject.

- (id) initWithCString: (const char*)  str  

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

Parameters:
str A UTF-8 encoded C string to initialize the OFString with
Returns:
An initialized OFString
- (id) initWithCString: (const char*)  str
encoding: (enum of_string_encoding)  encoding 

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

Parameters:
str A C string to initialize the OFString with
encoding The encoding of the C string
Returns:
An initialized OFString
- (id) initWithCString: (const char*)  str
encoding: (enum of_string_encoding)  encoding
length: (size_t)  len 

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

Parameters:
str A C string to initialize the OFString with
encoding The encoding of the C string
len The length of the C string
Returns:
An initialized OFString
- (id) initWithCString: (const char*)  str
length: (size_t)  len 

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

Parameters:
str A UTF-8 encoded C string to initialize the OFString with
len The length of the UTF-8 encoded C string
Returns:
An initialized OFString
- (id) initWithFormat: (OFString*)  fmt
,   ... 

Initializes an already allocated OFString with a format string. See printf for the format syntax.

Parameters:
fmt A string used as format to initialize the OFString
Returns:
An initialized OFString
- (id) initWithFormat: (OFString*)  fmt
arguments: (va_list)  args 

Initializes an already allocated OFString with a format string. See printf for the format syntax.

Parameters:
fmt A string used as format to initialize the OFString
args The arguments used in the format string
Returns:
An initialized OFString
- (id) initWithString: (OFString*)  str  

Initializes an already allocated OFString with another string.

Parameters:
str A string to initialize the OFString with
Returns:
An initialized OFString
- (size_t) length  
Returns:
The length of the string in Unicode characters
- (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
- (OFArray *) splitWithDelimiter: (OFString*)  delimiter  

Splits an OFString into an OFArray of OFStrings.

Parameters:
delimiter The delimiter for splitting
Returns:
An autoreleased OFArray with the splitted string
+ (id) string  
Returns:
A new autoreleased OFString
- (OFString *) stringByAppendingString: (OFString*)  str  

Creates a new string by appending another string.

Parameters:
str The string to append
Returns:
A new autoreleased OFString with the specified string appended
- (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
- (id) stringByXMLEscaping  

Escapes a string for use in an XML document.

Returns:
A new autoreleased string
- (id) stringByXMLUnescaping  

Unescapes XML in the string.

- (id) stringByXMLUnescapingWithHandler: (OFObject< OFXMLUnescapingDelegate > *)  h  

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

Parameters:
h An OFXMLUnescapingDelegate as a handler for unknown entities
+ (id) stringWithCString: (const char*)  str  

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

Parameters:
str A UTF-8 encoded C string to initialize the OFString with
Returns:
A new autoreleased OFString
+ (id) stringWithCString: (const char*)  str
encoding: (enum of_string_encoding)  encoding 

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

Parameters:
str A C string to initialize the OFString with
encoding The encoding of the C string
Returns:
A new autoreleased OFString
+ (id) stringWithCString: (const char*)  str
encoding: (enum of_string_encoding)  encoding
length: (size_t)  len 

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

Parameters:
str A C string to initialize the OFString with
encoding The encoding of the C string
len The length of the C string
Returns:
A new autoreleased OFString
+ (id) stringWithCString: (const char*)  str
length: (size_t)  len 

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

Parameters:
str A UTF-8 encoded C string to initialize the OFString with
len The length of the UTF-8 encoded C string
Returns:
A new autoreleased OFString
+ (id) stringWithFormat: (OFString*)  fmt
,   ... 

Creates a new OFString from a format string. See printf for the format syntax.

Parameters:
fmt A string used as format to initialize the OFString
Returns:
A new autoreleased OFString
+ (id) stringWithString: (OFString*)  str  

Creates a new OFString from another string.

Parameters:
str A string to initialize the OFString with
Returns:
A new autoreleased OFString
- (OFString *) substringFromIndex: (size_t)  start
toIndex: (size_t)  end 
Parameters:
start The index where the substring starts
end The index where the substring ends. This points BEHIND the last character!
Returns:
The substring as a new autoreleased OFString

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

Generated on Sun Mar 14 13:41:06 2010 for ObjFW by  doxygen 1.6.1