NSString Class Reference

Unicode string operation class. More...

#import <nsstring.h>

Inheritance diagram for NSString:

NSObject NSMutableString List of all members.

Public Member Functions

(id) - init
 Initialize string object.
(id) - initWithCString:
 Initialize string object with given C-style string.
(id) - initWithCString:length:
 Initialize string object with given C-style string and length.
(id) - initWithData:encoding:
 Initialize string object with data and encoding info.
(id) - initWithGString:
 Initiaize string by GString of glib.
(void) - dealloc
 Release resource for the object.
(size_t) - length
 Get length of the string.
(size_t) - cStringLength
 Get size of the string (by bytes).
(unichar_t) - characterAtIndex:
 Get indexed character.
(NSRange- rangeOfString:
 Get range of substring in the string.
(NSRange- rangeOfString:options:
 Get range of substring in the string.
(NSRange- rangeOfString:options:range:
 Get range of substring in the string.
(NSComparisonResult- compare:
 Compare 2 string object.
(NSString *) - stringByAppendingString:
 Add the string to the end of string.
(NSString *) - substringWithRange:
 Get substring from source string.
(NSString *) - stringByPaddingToLength:withString:startingAtIndex:
 Pad the string until given length.
(NSString *) - stringByTrimmingCharactersInSet:
 Remove head/tail characters which belongs to given set. And generate new string.
(NSMutableArray *) - componentsSeparatedByString:
 Separate string by given separator.
(const char *) - cString
 Get pointer of string.
(GString *) - gString
 Get GString data.

Protected Attributes

GString * str_body

Detailed Description

Unicode string operation class.

Description
NSString operates unicode string.


Member Function Documentation

- (unichar_t) characterAtIndex: (uint_t)  index  
 

Get indexed character.

Returns:
Unicode at the index.
Parameters:
index Index.
Description
Get indexed character.

- (NSComparisonResult) compare: (NSString *)  src  
 

Compare 2 string object.

Returns:
Result of comparison
Parameters:
src Source string.
Description
This method compares the string and source string. If this object is smaller than source, returns NSOrderedAscending .
Warning:
Do not pass nil as src.

- (NSMutableArray *) componentsSeparatedByString: (NSString *)  separator  
 

Separate string by given separator.

Returns:
Array of separated strings.
Parameters:
separator Separator string. DO NOT contain blanks at head and tail of the separator.
Description
Separate string by given separator. Spaces for each separated string are ignored.

- (const char *) cString  
 

Get pointer of string.

Returns:
Pointer of string. This NEVER be null.
Description
Get pointer of string.

- (size_t) cStringLength  
 

Get size of the string (by bytes).

Returns:
Size of string.
Description
Get size of the string (by bytes).

- (void) dealloc  
 

Release resource for the object.

Description
Release resource for the object.

Reimplemented from NSObject.

Reimplemented in NSMutableString.

- (GString *) gString  
 

Get GString data.

Returns:
GString object.
Description
Get GString data. GString is data structure defined by glib. This method is custom method for Cacao library. Do not call this from outside.
Warning:
This method does not have compatibility with Cocoa. Do not call this except internal use.

- (id) init  
 

Initialize string object.

Returns:
Generated object.
Description
Initialize unicode string object. The empty string is set.

Reimplemented from NSObject.

Reimplemented in NSMutableString.

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

Initialize string object with given C-style string.

Returns:
Generated object.
Parameters:
str Source C string.
Description
Initialize string object with given C-style string.

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

Initialize string object with given C-style string and length.

Returns:
Generated string.
Parameters:
str Source C string.
length Length of source string.
Description
Initialize string object with given C-style string.

- (id) initWithData: (NSData *)  data
encoding: (NSStringEncoding typ
 
 

Initialize string object with data and encoding info.

Returns:
Generated string.
Parameters:
data Source encoding.
typ Encoding type.
Description
Initialize string object with data and encoding info.

- (id) initWithGString: (GString *)  gstr  
 

Initiaize string by GString of glib.

Returns:
New string.
Parameters:
gstr Source string.
Description
Initialize string by GString of glib. The copy is NOT copid in this method, but released destructor of this object. Do not free the source string.
Warning:
This method does not have compatibility with Cocoa. Do not call this except internal use.

- (size_t) length  
 

Get length of the string.

Returns:
Length of string.
Description
Get length of the string.

- (NSRange) rangeOfString: (NSString *)  substr  
 

Get range of substring in the string.

Returns:
Range of substring. If it is not found, this value will be {NSNotFound, 0}.
Parameters:
substr Substring.
Description

- (NSRange) rangeOfString: (NSString *)  substr
options: (uint_t)  mask
 
 

Get range of substring in the string.

Returns:
Range of substring. If it is not found, this value will be {NSNotFound, 0}.
Parameters:
substr Substring.
mask Bit mask generated by NSStringSearchOption values.
Description

- (NSRange) rangeOfString: (NSString *)  substr
options: (uint_t)  mask
range: (NSRange range
 
 

Get range of substring in the string.

Returns:
Range of substring. If it is not found, this value will be {NSNotFound, 0}.
Parameters:
substr Substring.
mask Bit mask generated by NSStringSearchOption values.
Description

- (NSString *) stringByAppendingString: (NSString *)  src  
 

Add the string to the end of string.

Returns:
New string contains result of addition.
Parameters:
src Source string to append.
Description
Add the string to the end of string.

- (NSString *) stringByPaddingToLength: (size_t)  newlength
withString: (NSString *)  padstr
startingAtIndex: (uint_t)  padindex
 
 

Pad the string until given length.

Returns:
Generated string.
Parameters:
newlength The length of new string.
padstr Addtional string to be added to the end of current string.
padindex The start point to add the padstr to the current string. If the added length is not enough to the newlength, the padstr is added from beggining.

- (NSString *) stringByTrimmingCharactersInSet: (NSCharacterSet *)  set  
 

Remove head/tail characters which belongs to given set. And generate new string.

Parameters:
set Character set to choose trim target.
Description
Remove head/tail characters which belongs to given character set.

- (NSString *) substringWithRange: (NSRange range  
 

Get substring from source string.

Returns:
Substring of original
Parameters:
range Range of target substring.
Description
Get substring from source string. Invalid range causes system error.


Member Data Documentation

- (GString*) str_body [protected]
 

Main string data


The documentation for this class was generated from the following files:
Generated on Fri Feb 3 00:13:01 2006 for Cacao by  doxygen 1.4.5