s := "hello"; s[1] := 'E'; s[4] := 'O';set the variable s to "hEllO".
General Information | |
Operator | [] |
Syntaxe | expr [expr ] |
Type | binary |
Commutative | no |
Operand Types | first operand: string, indexed collection (list or array) or non-collection array, second operand: integer |
Result Type | char if first operand is a string, otherwise type of the returned item in the indexed collection or non-collection array. |
Functions | [expr ] : returns the character (or item in the indexed collection or in the non-collection array) number expr |
Note | this operator may be used in the composition of a left value. |
Expression Examples | ||
expression | result | |
"hello"[0] | 'h' | |
a := "hello"; a[1] | 'e' | |
a[3] | l | |
a[6] | raises an error | |
a[0] := 'H' | 'H' | a equals "Hello" |
list(1, 2, "hello", 4)[3] | "hello" | |
list(1, 2, "hello", 4)[4] | raises an error | |
first(select Person).name[2] := 'X' | 'X' |
General Information | |
Operators | [:] |
[?] | |
Syntaxes | expr [expr :expr ] |
expr [?] | |
Type | ternary or unary |
Operand Types | first operand: string or indexed collections (list or array), second operand and third operand: integer |
Result Type | a list of char if first operand is a string, otherwise a list of returned items in the indexed collection or non-collection array. |
Functions | [expr1:expr2] : returns a lits of characters (or items in collection) indexed from expr1 to expr2 |
[?] : returns a list of all characters (or items in collection) |
Expression Examples | |
expression | result |
"hello"[0:2] | list('h', 'e', 'l') |
"hello"[?] | list('h', 'e', 'l', 'l', 'o', '\000') |
list(1, 2, "hello", 4)[2:3] | list("hello", 4) |
array(1, 2, "hello", 4)[?] | list(1, 2, "hello", 4) |
first(select Person).name[?] | list('j', 'o', 'h', 'n', '\000') |
list(select class.type = "user")[0:4].name | list("Employee", "Address", "Person") |
EyeDB manual