Public Member Functions | |
(CPString) | - cssString [implementation] |
(CGSize) | - sizeWithFont: [implementation] |
(CPString) | - string [implementation] |
(id) | - initWithString: [implementation] |
(id) | - initWithFormat: [implementation] |
(CPString) | - description [implementation] |
(int) | - length [implementation] |
(CPString) | - characterAtIndex: [implementation] |
(CPString) | - stringByAppendingFormat: [implementation] |
(CPString) | - stringByAppendingString: [implementation] |
(CPString) | - stringByPaddingToLength:withString:startingAtIndex: [implementation] |
(CPArray) | - componentsSeparatedByString: [implementation] |
(CPString) | - substringFromIndex: [implementation] |
(CPString) | - substringWithRange: [implementation] |
(CPString) | - substringToIndex: [implementation] |
(CPRange) | - rangeOfString: [implementation] |
(CPRange) | - rangeOfString:options: [implementation] |
(CPRange) | - rangeOfString:options:range: [implementation] |
(CPString) | - stringByReplacingOccurrencesOfString:withString: [implementation] |
(CPString) | - stringByReplacingOccurrencesOfString:withString:options:range: [implementation] |
(CPString) | - stringByReplacingCharactersInRange:withString: [implementation] |
(CPComparisonResult) | - compare: [implementation] |
(CPComparisonResult) | - caseInsensitiveCompare: [implementation] |
(CPComparisonResult) | - compare:options: [implementation] |
(CPComparisonResult) | - compare:options:range: [implementation] |
(BOOL) | - hasPrefix: [implementation] |
(BOOL) | - hasSuffix: [implementation] |
(BOOL) | - isEqualToString: [implementation] |
(unsigned) | - hash [implementation] |
(CPString) | - capitalizedString [implementation] |
(CPString) | - lowercaseString [implementation] |
(CPString) | - uppercaseString [implementation] |
(double) | - doubleValue [implementation] |
(BOOL) | - boolValue [implementation] |
(float) | - floatValue [implementation] |
(int) | - intValue [implementation] |
(CPArray) | - pathComponents [implementation] |
(CPString) | - pathExtension [implementation] |
(CPString) | - lastPathComponent [implementation] |
(CPString) | - stringByDeletingLastPathComponent [implementation] |
(CPString) | - stringByStandardizingPath [implementation] |
(CPString) | - copy [implementation] |
Static Public Member Functions | |
(id) | + stringWithHash: [implementation] |
(id) | + stringWithString: [implementation] |
(id) | + stringWithFormat: [implementation] |
Exact character match
Start searching from the end of the string
Numbers in the string are compared as numbers instead of strings
CPString is an object that allows management of strings. Because CPString is based on the JavaScript String
object, CPStrings are immutable, although the class does have methods that create new CPStrings generated from modifications to the receiving instance.
A handy feature of CPString instances is that they can be used wherever a JavaScript is required, and vice versa.
Definition at line 28 of file CPStringDrawing.j.
- (BOOL) boolValue | [implementation] |
Returns YES
on encountering one of "Y", "y", "T", "t", or a digit 1-9. Returns NO
otherwise. This method skips the initial whitespace characters, +,- followed by Zeroes.
Definition at line 556 of file CPString.j.
- (CPString) capitalizedString | [implementation] |
Returns a copy of the receiver with all the first letters of words capitalized.
Definition at line 514 of file CPString.j.
- (CPComparisonResult) caseInsensitiveCompare: | (CPString) | aString | [implementation] |
Definition at line 422 of file CPString.j.
- (CPString) characterAtIndex: | (unsigned) | anIndex | [implementation] |
Returns the character at the specified index.
anIndex | the index of the desired character |
Definition at line 171 of file CPString.j.
- (CPComparisonResult) compare: | (CPString) | aString | [implementation] |
Compares the receiver to the specified string.
aString | the string with which to compare |
Definition at line 411 of file CPString.j.
- (CPComparisonResult) compare: | (CPString) | aString | ||
options: | (int) | aMask | ||
[implementation] |
Compares the receiver to the specified string, using options.
aString | the string with which to compare | |
aMask | the options to use for the comparison |
Definition at line 433 of file CPString.j.
- (CPComparisonResult) compare: | (CPString) | aString | ||
options: | (int) | aMask | ||
range: | (CPRange) | range | ||
[implementation] |
Compares the receiver to the specified string, using options in range.
aString | the string with which to compare the range of the receiver specified by range. | |
aMask | the options to use for the comparison | |
range | the range of the receiver over which to perform the comparison. The range must not exceed the bounds of the receiver. |
Definition at line 459 of file CPString.j.
Tokenizes the receiver string using the specified delimiter. For example, if the receiver is:
"arash.francisco.ross.tom"and the delimiter is:
"."the returned array would contain:
["arash", "francisco", "ross", "tom"]
the | delimiter |
Definition at line 244 of file CPString.j.
- (CPString) copy | [implementation] |
Definition at line 635 of file CPString.j.
- (CPString) cssString | [implementation] |
Returns the string
Definition at line 33 of file CPStringDrawing.j.
- (CPString) description | [implementation] |
Returns a description of this CPString object.
Definition at line 154 of file CPString.j.
- (double) doubleValue | [implementation] |
Returns the text as a floating point value.
Definition at line 546 of file CPString.j.
- (float) floatValue | [implementation] |
Returns the text as a float point value.
Definition at line 565 of file CPString.j.
- (unsigned) hash | [implementation] |
Returns a hash of the string instance.
Definition at line 498 of file CPString.j.
- (BOOL) hasPrefix: | (CPString) | aString | [implementation] |
Returns YES
if the receiver starts with the specified string. If aString
is empty, the method will return NO
.
Definition at line 472 of file CPString.j.
- (BOOL) hasSuffix: | (CPString) | aString | [implementation] |
Returns NO
if the receiver ends with the specified string. If aString
is empty, the method will return NO
.
Definition at line 482 of file CPString.j.
- (id) initWithFormat: | (CPString) | format | ||
, | ... | |||
[implementation] |
Initializes a string using C printf-style formatting. First argument should be a constant format string, like ' "float val = %f" ', remaining arguments should be the variables to print the values of, comma-separated.
format | the format to be used, printf-style |
Definition at line 126 of file CPString.j.
- (id) initWithString: | (CPString) | aString | [implementation] |
Initializes the string with data from the specified string.
aString | the string to copy data from |
Definition at line 116 of file CPString.j.
- (int) intValue | [implementation] |
Returns the text as an integer
Definition at line 573 of file CPString.j.
- (BOOL) isEqualToString: | (CPString) | aString | [implementation] |
Returns YES
if the specified string contains the same characters as the receiver.
Definition at line 490 of file CPString.j.
- (CPString) lastPathComponent | [implementation] |
Returns the last component of this string. This method assumes that the string's content is a '/' separated file system path.
Definition at line 603 of file CPString.j.
- (int) length | [implementation] |
Returns the number of UTF-8 characters in the string.
Definition at line 162 of file CPString.j.
- (CPString) lowercaseString | [implementation] |
Returns a copy of the string with all its characters made lower case.
Definition at line 530 of file CPString.j.
- (CPArray) pathComponents | [implementation] |
Returns an the path components of this string. This method assumes that the string's content is a '/' separated file system path.
Definition at line 583 of file CPString.j.
- (CPString) pathExtension | [implementation] |
Returns the extension of the file denoted by this string. The '.' is not a part of the extension. This method assumes that the string's contents is the path to a file or just a filename.
Definition at line 593 of file CPString.j.
- (CPRange) rangeOfString: | (CPString) | aString | [implementation] |
Finds the range of characters in the receiver where the specified string exists. If the string does not exist in the receiver, the range length
will be 0.
aString | the string to search for in the receiver |
Definition at line 287 of file CPString.j.
- (CPRange) rangeOfString: | (CPString) | aString | ||
options: | (int) | aMask | ||
[implementation] |
Finds the range of characters in the receiver where the specified string exists. The search is subject to the options specified in the specified mask which can be a combination of:
CPCaseInsensitiveSearch CPLiteralSearch CPBackwardsSearch CPAnchoredSearch CPNumericSearch
aString | the string to search for | |
aMask | the options to use in the search |
length
of the range will be 0. Definition at line 309 of file CPString.j.
- (CPRange) rangeOfString: | (CPString) | aString | ||
options: | (int) | aMask | ||
range: | (CPrange) | aRange | ||
[implementation] |
Finds the range of characters in the receiver where the specified string exists in the given range of the receiver.The search is subject to the options specified in the specified mask which can be a combination of:
CPCaseInsensitiveSearch CPLiteralSearch CPBackwardsSearch CPAnchoredSearch CPNumericSearch
aString | the string to search for | |
aMask | the options to use in the search | |
aRange | the range of the receiver in which to search for |
length
of the range will be 0. Definition at line 332 of file CPString.j.
- (CGSize) sizeWithFont: | (CPFont) | aFont | [implementation] |
Definition at line 38 of file CPStringDrawing.j.
- (id) string | [implementation] |
Returns a string made by appending to the reciever a string constructed from a given format string and the floowing arguments
format | the format string in printf-style. |
Definition at line 184 of file CPString.j.
Creates a new CPString from the concatenation of the receiver and the specified string.
aString | the string to append to the receiver |
Definition at line 197 of file CPString.j.
- (CPString) stringByDeletingLastPathComponent | [implementation] |
Deletes the last path component of a string. This method assumes that the string's content is a '/' separated file system path.
Definition at line 614 of file CPString.j.
- (CPString) stringByPaddingToLength: | (unsigned) | aLength | ||
withString: | (CPString) | aString | ||
startingAtIndex: | (unsigned) | anIndex | ||
[implementation] |
Returns a new string formed by padding characters or removing them. If the padding length is shorter than the receiver's length, the new string will be trimmed down to the padding length size. If the padding length is longer than the receiver's length, then the new string is repeatedly padded with the characters from the specified string starting at the specified index.
aLength | the desired length of the new CPString | |
aString | the padding string to use (if necessary) | |
anIndex | the index of the padding string to start from (if necessary to use) |
Definition at line 214 of file CPString.j.
- (CPString) stringByReplacingCharactersInRange: | (CPRange) | range | ||
withString: | (CPString) | replacement | ||
[implementation] |
Definition at line 398 of file CPString.j.
- (CPString) stringByReplacingOccurrencesOfString: | (CPString) | target | ||
withString: | (CPString) | replacement | ||
[implementation] |
Returns a new string in which all occurrences of a target string in the reciever are replaced by another given string.
target | The string to replace. | |
replacement | the string with which to replace the target |
Definition at line 362 of file CPString.j.
- (CPString) stringByReplacingOccurrencesOfString: | (CPString) | target | ||
withString: | (CPString) | replacement | ||
options: | (int) | options | ||
range: | (CPRange) | searchRange | ||
[implementation] |
Definition at line 376 of file CPString.j.
- (CPString) stringByStandardizingPath | [implementation] |
Definition at line 630 of file CPString.j.
+ (id) stringWithFormat: | (CPString) | format | ||
, | ... | |||
[implementation] |
Creates a new string using C printf-style formatting. First argument should be a constant format string, like ' "float val = %f" ', remaining arguments should be the variables to print the values of, comma-separated.
format | the format to be used, printf-style |
Definition at line 142 of file CPString.j.
+ (id) stringWithHash: | (unsigned) | aHash | [implementation] |
Returns a CPString containing the specified hash.
aHash | the hash to represent as a string |
Definition at line 91 of file CPString.j.
+ (id) stringWithString: | (CPString) | aString | [implementation] |
Returns a copy of the specified string.
aString | a non-nil string to copy |
CPInvalidArgumentException | if aString is nil |
Definition at line 102 of file CPString.j.
- (CPString) substringFromIndex: | (unsigned) | anIndex | [implementation] |
Returns a substring starting from the specified index to the end of the receiver.
anIndex | the starting string (inclusive) |
Definition at line 254 of file CPString.j.
- (CPString) substringToIndex: | (unsigned) | anIndex | [implementation] |
Creates a substring from the beginning of the receiver to the specified index.
anIndex | the last index of the receiver to use for the substring (inclusive) |
Definition at line 274 of file CPString.j.
- (CPString) substringWithRange: | (CPRange) | aRange | [implementation] |
Returns a substring starting from the specified range location
to the range length
.
the | range of the substring |
Definition at line 264 of file CPString.j.
- (CPString) uppercaseString | [implementation] |
Returns a copy of the string with all its characters made upper case.
Definition at line 538 of file CPString.j.