SubString
Not available in this language yet.
SubString( value, start, [ length ] )
SubString( value, start, [ length ] )
SubString( value, start, [ length ] )
Not available in this language yet.
SubString( value, start, [ length ] )
Description
The SubString
function returns a portion of the value
string
beginning at the character start
position for length
characters
long.
Although we mention characters, technically, we are talking about code points. In Unicode, a code point is usually but not always a character. Code points can sometimes represent single characters, but can also represent formatting and other non-alphanumeric characters. For example, the character é can be the single character "e" that includes an acute accent (U+00E9), or it could be displayed as a single character but be composed of an "e" (U+0065) and a "combining" acute accent (U+0301). Visually, you cannot distinguish between the two. |
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
String |
The string having the subset returned. |
|
Integer |
The position in the source string where the |
|
Integer |
Optional - The number of characters to extract. The default returns
the remaining portion of the source string after beginning at |
Although we mention characters, technically, we are talking about code points. In Unicode, a code point is usually but not always a character. Code points can sometimes represent single characters, but can also represent formatting and other non-alphanumeric characters. For example, the character é can be the single character "e" that includes an acute accent (U+00E9), or it could be displayed as a single character but be composed of an "e" (U+0065) and a "combining" acute accent (U+0301). Visually, you cannot distinguish between the two. |
Examples
The query below executes an array of independent SubString
operations
and returns the results in an array. The result array position matches
the execution array position. The first operation takes a source string
containing "ABCDEFGHIJK" and extracts a string starting at the 2
position for 3 characters. The resultant string "CDE" is placed in the
top position of the result array. The second operation uses the same
input string, but starts at the 1 position ("B") and extracts 6
characters("BCDEFG"). The third operations extracts the last 4
characters from the end of the source string.
Not available in this language yet.
Not available in this language yet.
System.out.println(
client.query(
Arr(
SubString("ABCDEFGHIJK",2,3),
SubString("ABCDEFGHIJK",1,6),
SubString("ABCDEFGHIJK",-4),
SubString("ABCDEFGHIJK",-3, 2)
)
).get());
[
"CDE",
"BCDEFH",
"HIJK",
"IJ"
]
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!