An immutable string (collection of characters). More...
#import <CPString.h>
Class Methods | |
(id) | + alloc |
(void) | + initialize |
(CPString) | + JSONFromObject: |
(CPDictionary) | + metricsOfFont: |
(CPString) | + pathWithComponents: |
(id) | + string |
(id) | + stringWithFormat: |
(id) | + stringWithHash: |
(id) | + stringWithString: |
(CPString) | + UUID |
Class Methods inherited from CPObject | |
(BOOL) | + accessInstanceVariablesDirectly |
(id) | + allocWithCoder: |
(BOOL) | + automaticallyNotifiesObserversForKey: |
(void) | + cancelPreviousPerformRequestsWithTarget: |
(void) | + cancelPreviousPerformRequestsWithTarget:selector:object: |
(Class) | + class |
(BOOL) | + conformsToProtocol: |
(void) | + exposeBinding: |
(IMP) | + instanceMethodForSelector: |
(BOOL) | + instancesImplementSelector: |
(BOOL) | + instancesRespondToSelector: |
(BOOL) | + isBindingExclusive: |
(BOOL) | + isSubclassOfClass: |
(CPSet) | + keyPathsForValuesAffectingValueForKey: |
(void) | + load |
(id) | + new |
(void) | + object:performSelector:withObject:afterDelay:inModes: |
(void) | + setVersion: |
(Class) | + superclass |
(int) | + version |
An immutable string (collection of characters).
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 2 of file CPString.h.
|
implementation |
Allocates a new instance of the receiving class
Reimplemented from CPObject.
Definition at line 87 of file CPString.j.
|
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 698 of file CPString.j.
|
implementation |
Returns a copy of the receiver with all the first letters of words capitalized.
Definition at line 646 of file CPString.j.
|
implementation |
Definition at line 488 of file CPString.j.
|
implementation |
Returns the character at the specified index.
anIndex | the index of the desired character |
Definition at line 195 of file CPString.j.
Returns a string containing characters the receiver and a given string have in common, starting from the beginning of each up to the first characters that aren't equivalent.
aString | the string with which to compare the receiver |
Definition at line 610 of file CPString.j.
|
implementation |
Returns a string containing characters the receiver and a given string have in common, starting from the beginning of each up to the first characters that aren't equivalent.
aString | the string with which to compare the receiver |
aMask | options for comparison |
Definition at line 621 of file CPString.j.
|
implementation |
Compares the receiver to the specified string.
aString | the string with which to compare |
Definition at line 478 of file CPString.j.
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 502 of file CPString.j.
|
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 541 of file CPString.j.
|
implementation |
Tokenizes the receiver string using the characters in a given set. For example, if the receiver is: "Baku baku to jest skład."
and the set is [CPCharacterSet whitespaceCharacterSet] the returned array would contain:
["Baku", "baku", "to", "jest", "", "skład."]
Adjacent occurrences of the separator characters produce empty strings in the result.
A | character set containing the characters to use to split the receiver. Must not be nil. |
Provided by category CPString(CPCharacterSetAdditions).
Definition at line 435 of file CPCharacterSet.j.
|
implementation |
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 271 of file CPString.j.
|
implementation |
Returns the string
Provided by category CPString(CPStringDrawing).
Definition at line 45 of file CPStringDrawing.j.
|
implementation |
Returns a description of this CPString object.
Reimplemented from CPObject.
Definition at line 178 of file CPString.j.
|
implementation |
Returns the text as a floating point value.
Definition at line 689 of file CPString.j.
|
implementation |
Returns the text as a float point value.
Definition at line 707 of file CPString.j.
|
implementation |
Returns YES
if the receiver starts with the specified string. If aString
is empty, the method will return NO
.
Definition at line 554 of file CPString.j.
|
implementation |
Returns YES
if the receiver ends with the specified string. If aString
is empty, the method will return NO
.
Definition at line 564 of file CPString.j.
|
implementation |
Reimplemented from CPObject.
Provided by category CPString(CPStringDrawing).
Definition at line 55 of file CPStringDrawing.j.
|
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 150 of file CPString.j.
|
implementation |
Initializes the string with data from the specified string.
aString | the string to copy data from |
Definition at line 133 of file CPString.j.
|
implementation |
Returns the text as an integer
Definition at line 723 of file CPString.j.
|
implementation |
Returns the text as an integer
Definition at line 715 of file CPString.j.
|
implementation |
Determines if anObject
is functionally equivalent to the receiver.
YES
if anObject
is functionally equivalent to the receiver. Reimplemented from CPObject.
Definition at line 569 of file CPString.j.
|
implementation |
Returns YES
if the specified string contains the same characters as the receiver.
Definition at line 584 of file CPString.j.
|
implementation |
Returns a string representing the supplied JavaScript object encoded as JSON.
Provided by category CPString(JSON).
Definition at line 926 of file CPString.j.
|
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 824 of file CPString.j.
|
implementation |
Returns the number of UTF-8 characters in the string.
Definition at line 186 of file CPString.j.
|
implementation |
Returns a copy of the string with all its characters made lower case.
Definition at line 665 of file CPString.j.
|
implementation |
Returns a dictionary with the items "ascender", "descender", "lineHeight"
Provided by category CPString(CPStringDrawing).
Definition at line 37 of file CPStringDrawing.j.
|
implementation |
Returns a JavaScript object decoded from the string's JSON representation.
Provided by category CPString(JSON).
Definition at line 934 of file CPString.j.
|
implementation |
Returns an the path components of this string. This method assumes that the string's content is a '/' separated file system path. Multiple '/' separators between components are truncated to a single one.
Definition at line 734 of file CPString.j.
|
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 811 of file CPString.j.
|
implementation |
Returns a string built from the strings in a given array by concatenating them with a path separator between each pair. This method assumes that the string's content is a '/' separated file system path. Multiple '/' separators between components are truncated to a single one.
Definition at line 771 of file CPString.j.
|
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 322 of file CPString.j.
|
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 CPDiacriticInsensitiveSearch 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 345 of file CPString.j.
|
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 CPDiacriticInsensitiveSearch 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 |
Definition at line 370 of file CPString.j.
|
implementation |
Provided by category CPString(CPStringDrawing).
Definition at line 50 of file CPStringDrawing.j.
|
implementation |
Provided by category CPString(CPStringDrawing).
Definition at line 112 of file CPStringDrawing.j.
|
implementation |
Returns a new string
Provided by category CPString(CPTextFieldAdditions).
Definition at line 98 of file CPString.j.
Returns a string made by appending to the receiver a string constructed from a given format string and the following arguments
format | the format string in printf-style. |
Definition at line 208 of file CPString.j.
Returns a new string made by appending to the receiver a given string This method assumes that the string's content is a '/' separated file system path. Multiple '/' separators between components are truncated to a single one.
Definition at line 839 of file CPString.j.
Returns a new string made by appending to the receiver an extension separator followed by a given extension This method assumes that the extension separator is a '.' Extension can't include a '/' character, receiver can't be empty or be just a '/'. If so the result will be the receiver itself. Multiple '/' separators between components are truncated to a single one.
Definition at line 854 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 221 of file CPString.j.
|
implementation |
Deletes the last path component of a string. This method assumes that the string's content is a '/' separated file system path. Multiple '/' separators between components are truncated to a single one.
Definition at line 876 of file CPString.j.
|
implementation |
Deletes the extension of a string. This method assumes that the string's content is a '/' separated file system path. Multiple '/' separators between components are truncated to a single one.
Definition at line 900 of file CPString.j.
|
implementation |
Definition at line 409 of file CPString.j.
|
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 238 of file CPString.j.
|
implementation |
Definition at line 458 of file CPString.j.
|
implementation |
Returns a new string in which all occurrences of a target string in the receiver are replaced by another given string.
target | The string to replace. |
replacement | the string with which to replace the target |
Definition at line 421 of file CPString.j.
|
implementation |
Definition at line 435 of file CPString.j.
|
implementation |
Definition at line 912 of file CPString.j.
|
implementation |
Provided by category CPString(CPCharacterSetAdditions).
Definition at line 462 of file CPCharacterSet.j.
|
implementation |
Returns a new string with leading and trailing whitespace trimmed
Definition at line 466 of file CPString.j.
|
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 166 of file CPString.j.
|
implementation |
Returns a CPString containing the specified hash.
aHash | the hash to represent as a string |
Definition at line 107 of file CPString.j.
|
implementation |
Returns a copy of the specified string.
aString | a non-nil string to copy |
CPInvalidArgumentException | if aString is nil |
Definition at line 119 of file CPString.j.
|
implementation |
Returns a copy of the string stripped of diacritical marks.
Definition at line 681 of file CPString.j.
|
implementation |
Returns a substring starting from the specified index to the end of the receiver.
anIndex | the starting string (inclusive) |
Definition at line 281 of file CPString.j.
|
implementation |
Creates a substring of characters from the receiver, starting at the beginning and up to the given index.
anIndex | the index of the receiver where the substring should end (non inclusive) |
Definition at line 306 of file CPString.j.
|
implementation |
Returns a substring starting from the specified range location
to the range length
.
the | range of the substring |
Definition at line 291 of file CPString.j.
|
implementation |
Returns a hash of the string instance.
Reimplemented from CPObject.
Definition at line 592 of file CPString.j.
|
implementation |
Returns a copy of the string with all its characters made upper case.
Definition at line 673 of file CPString.j.
|
implementation |
Returns a randomly generated Universally Unique Identifier.
Provided by category CPString(UUID).
Definition at line 947 of file CPString.j.