![]() |
API
0.9.6
|
An immutable string (collection of characters). More...
#import <CPString.h>
Class Methods | |
(id) | + alloc |
(CPString) | + JSONFromObject: |
(CPDictionary) | + metricsOfFont: |
(CPString) | + pathWithComponents: |
(id) | + string |
(id) | + stringWithFormat: |
(id) | + stringWithHash: |
(id) | + stringWithString: |
(CPString) | + UUID |
![]() | |
(BOOL) | + accessInstanceVariablesDirectly |
(id) | + allocWithCoder: |
(BOOL) | + automaticallyNotifiesObserversForKey: |
(Class) | + class |
(void) | + exposeBinding: |
(void) | + initialize |
(IMP) | + instanceMethodForSelector: |
(BOOL) | + instancesRespondToSelector: |
(BOOL) | + isSubclassOfClass: |
(CPSet) | + keyPathsForValuesAffectingValueForKey: |
(void) | + load |
(id) | + new |
(void) | + setVersion: |
(Class) | + superclass |
(int) | + version |
Additional Inherited Members | |
![]() | |
Class | isa |
An immutable string (collection of characters).
A case insensitive search
Exact character match
Start searching from the end of the string
Numbers in the string are compared as numbers instead of strings
Search ignores diacritic marks.
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 92 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 679 of file CPString.j.
|
implementation |
Returns a copy of the receiver with all the first letters of words capitalized.
Definition at line 635 of file CPString.j.
|
implementation |
Definition at line 486 of file CPString.j.
|
implementation |
Returns the character at the specified index.
anIndex | the index of the desired character |
Definition at line 200 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 599 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 610 of file CPString.j.
|
implementation |
Compares the receiver to the specified string.
aString | the string with which to compare |
Definition at line 476 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 497 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 530 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 422 of file CPCharacterSet.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 276 of file CPString.j.
|
implementation |
Returns the string
Provided by category CPString(CPStringDrawing).
Definition at line 43 of file CPStringDrawing.j.
|
implementation |
Returns a description of this CPString object.
Reimplemented from CPObject.
Definition at line 183 of file CPString.j.
|
implementation |
Returns the text as a floating point value.
Definition at line 670 of file CPString.j.
|
implementation |
Returns the text as a float point value.
Definition at line 688 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 543 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 553 of file CPString.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 155 of file CPString.j.
|
implementation |
Initializes the string with data from the specified string.
aString | the string to copy data from |
Definition at line 138 of file CPString.j.
|
implementation |
Returns the text as an integer
Definition at line 696 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 558 of file CPString.j.
|
implementation |
Returns YES
if the specified string contains the same characters as the receiver.
Definition at line 573 of file CPString.j.
|
implementation |
Returns a string representing the supplied JavaScript object encoded as JSON.
Provided by category CPString(JSON).
Definition at line 899 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 797 of file CPString.j.
|
implementation |
Returns the number of UTF-8 characters in the string.
Definition at line 191 of file CPString.j.
|
implementation |
Returns a copy of the string with all its characters made lower case.
Definition at line 654 of file CPString.j.
|
implementation |
Returns a dictionary with the items "ascender", "descender", "lineHeight"
Provided by category CPString(CPStringDrawing).
Definition at line 35 of file CPStringDrawing.j.
|
implementation |
Returns a JavaScript object decoded from the string's JSON representation.
Provided by category CPString(JSON).
Definition at line 907 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 707 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 784 of file CPString.j.
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 744 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 327 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 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 349 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 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 373 of file CPString.j.
|
implementation |
Provided by category CPString(CPStringDrawing).
Definition at line 48 of file CPStringDrawing.j.
|
implementation |
Provided by category CPString(CPStringDrawing).
Definition at line 53 of file CPStringDrawing.j.
|
implementation |
Returns a new string
Provided by category CPString(CPTextFieldAdditions).
Definition at line 103 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 213 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 812 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 827 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 226 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 849 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 873 of file CPString.j.
|
implementation |
Definition at line 407 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 243 of file CPString.j.
|
implementation |
Definition at line 456 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 419 of file CPString.j.
|
implementation |
Definition at line 433 of file CPString.j.
|
implementation |
Definition at line 885 of file CPString.j.
|
implementation |
Provided by category CPString(CPCharacterSetAdditions).
Definition at line 449 of file CPCharacterSet.j.
|
implementation |
Returns a new string with leading and trailing whitespace trimmed
Definition at line 464 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 171 of file CPString.j.
|
implementation |
Returns a CPString containing the specified hash.
aHash | the hash to represent as a string |
Definition at line 112 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 124 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 286 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 311 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 296 of file CPString.j.
|
implementation |
Returns a hash of the string instance.
Reimplemented from CPObject.
Definition at line 581 of file CPString.j.
|
implementation |
Returns a copy of the string with all its characters made upper case.
Definition at line 662 of file CPString.j.
|
implementation |
Returns a randomly generated Universally Unique Identifier.
Provided by category CPString(UUID).
Definition at line 920 of file CPString.j.