Public Member Functions | |
(CPString) | - cssString [implementation] |
(CGSize) | - sizeWithFont: [implementation] |
(CGSize) | - sizeWithFont:inWidth: [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] |
(JSObject) | - objectFromJSON [implementation] |
Static Public Member Functions | |
(id) | + stringWithHash: [implementation] |
(id) | + stringWithString: [implementation] |
(id) | + stringWithFormat: [implementation] |
(CPString) | + JSONFromObject: [implementation] |
(CPString) | + UUID [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 32 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 563 of file CPString.j.
- (CPString) capitalizedString | [implementation] |
Returns a copy of the receiver with all the first letters of words capitalized.
Definition at line 521 of file CPString.j.
- (CPComparisonResult) caseInsensitiveCompare: | (CPString) | aString | [implementation] |
Definition at line 429 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 175 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 418 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 440 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 466 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 251 of file CPString.j.
- (CPString) copy | [implementation] |
Definition at line 647 of file CPString.j.
- (CPString) cssString | [implementation] |
Returns the string
Definition at line 37 of file CPStringDrawing.j.
- (CPString) description | [implementation] |
Returns a description of this CPString object.
Definition at line 158 of file CPString.j.
- (double) doubleValue | [implementation] |
Returns the text as a floating point value.
Definition at line 553 of file CPString.j.
- (float) floatValue | [implementation] |
Returns the text as a float point value.
Definition at line 572 of file CPString.j.
- (unsigned) hash | [implementation] |
Returns a hash of the string instance.
Definition at line 505 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 479 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 489 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 130 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 120 of file CPString.j.
- (int) intValue | [implementation] |
Returns the text as an integer
Definition at line 580 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 497 of file CPString.j.
+ (CPString) JSONFromObject: | (JSObject) | anObject | [implementation] |
Returns a string representing the supplied JavaScript object encoded as JSON.
Definition at line 660 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 615 of file CPString.j.
- (int) length | [implementation] |
Returns the number of UTF-8 characters in the string.
Definition at line 166 of file CPString.j.
- (CPString) lowercaseString | [implementation] |
Returns a copy of the string with all its characters made lower case.
Definition at line 537 of file CPString.j.
- (JSObject) objectFromJSON | [implementation] |
Returns a JavaScript object decoded from the string's JSON representation.
Definition at line 668 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 590 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 605 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 294 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 316 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 339 of file CPString.j.
- (CGSize) sizeWithFont: | (CPFont) | aFont | [implementation] |
Definition at line 42 of file CPStringDrawing.j.
- (CGSize) sizeWithFont: | (CPFont) | aFont | ||
inWidth: | (float) | aWidth | ||
[implementation] |
Definition at line 47 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 188 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 201 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 626 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 218 of file CPString.j.
- (CPString) stringByReplacingCharactersInRange: | (CPRange) | range | ||
withString: | (CPString) | replacement | ||
[implementation] |
Definition at line 405 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 369 of file CPString.j.
- (CPString) stringByReplacingOccurrencesOfString: | (CPString) | target | ||
withString: | (CPString) | replacement | ||
options: | (int) | options | ||
range: | (CPRange) | searchRange | ||
[implementation] |
Definition at line 383 of file CPString.j.
- (CPString) stringByStandardizingPath | [implementation] |
Definition at line 642 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 146 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 94 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 106 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 261 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 281 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 271 of file CPString.j.
- (CPString) uppercaseString | [implementation] |
Returns a copy of the string with all its characters made upper case.
Definition at line 545 of file CPString.j.
+ (CPString) UUID | [implementation] |
Returns a randomly generated Universally Unique Identifier.
Definition at line 681 of file CPString.j.