String expressions
For the complete documentation index see: llms.txt
All documentation pages available in markdown.
This page describes string expressions that run the same Unicode-aware logic as string Operate API operations, inside an expression tree rather than against a named bin.
Read expressions such as string_contains and string_strlen evaluate to an integer, boolean, or string. That makes them projection: they shape what a command returns for each record, in operate, in a batch, and in a query. Wrap one in comparison or logic to get the Boolean a record filter needs. They are also accepted as secondary-index filter expressions.
Comparison operators (eq, ne, gt, ge, lt, le) are not Unicode-aware: they order String values by UTF-8 bytes. string_contains can match a spelling that eq rejects. See Compare String values.
String expressions that read stored data can evaluate to unknown; see Unknown results. Invalid UTF-8 in the stored value is an additional cause specific to String.
Invalid UTF-8 behaves differently across the two surfaces: through operate a malformed bin returns AS_ERR_INVALID_ENCODING, while in a filter expression it evaluates to unknown and the record is silently excluded from results. See String operations and UTF-8 validation.
A string operand is a bin, read with bin_str, or any expression that evaluates to a string.
When to use expressions versus Operate API
Operations and expressions covers the general split: an operation changes what is stored, while an expression produces a value to filter on, project, or store. Two cases are particular to String.
For worked examples, see string examples.
Modify expressions return a value
String modify operations write the bin and return nothing. Every modify operation grouped under Modify below instead evaluates to the transformed string without writing it back. Use them to project or compare a normalized value, and use the Operate API when you need to persist the change.
Reaching a String nested in a List or Map
Use a context path on the String Operate API, or compose string expressions with list or map expressions. See Strings nested in a List or Map below for a worked example.
Naming differences from AEL text
Every Operate API string operation has an expression form, but a few are spelled differently in AEL text than in the client builders, and a few have no AEL function at all:
insertissplicein AEL, which disambiguates it from the list and mapinsertfunctions. The client helpers keep theinsertname.byte_lengthisbytesLengthin AEL. The client helpers keep thebyte_lengthname.to_doubleistoFloatandto_integeristoIntin AEL, which names them after the AEL type rather than the client one. Pin the receiver before either, as in$.rate:STRING.toFloat(), so the compiler parses the string rather than casting a number.append,prepend,concathave no AEL function. AEL concatenates with the type-directed+operator. The client helpers exposestring_append,string_prepend, andstring_concatfor consistency with the Operate API.regex_comparehas no AEL function either. AEL matches with the infix=~operator and a regex literal, writtenexpr =~ /pattern/flags. The client helpers exposestring_regex_compare.
regexReplace replaces only the first match unless the pattern carries the g flag, written /pattern/g. The client helpers replace all matches when passed the GLOBAL regex flag. AEL writes flags as letters on the regex literal rather than as a bit field, and takes a subset of the flags the builders do — see Regex flags for the mapping and for which are valid where.
These names apply to AEL text. For AEL syntax, see the AEL reference.
Migration from cmp_regex
Prefer string_regex_compare over legacy cmp_regex. The legacy form uses POSIX regex and is not Unicode-compatible.
Strings nested in a List or Map
Nest a string expression inside a list or map expression to reach a String inside a CDT. The collection expression projects the value, and the string expression transforms it.
The Operate API reaches the same values through a context path and writes the result back in place. Use expressions when the result feeds a filter, when several operations compose into one value, or for expression_read projections.
This reaches vehicles[0].make in the sample data from Working with nested collection data types and uppercases it, so evaluating it against that record yields "TOYOTA".
The two SDKs take AEL text, where the path does the navigating: select_from() and selectFrom() document it as their primary input. The other clients compose the same thing from builders — the list getter projects the Map, the map getter projects the String, and the string expression transforms it. Rust can also compile AEL, with from_ael, but its read operation takes a built expression.
// AEL text, which selectFrom() and where() take directly.String exp = "($.vehicles.[0].make:STRING).upper()";# AEL text, which select_from() and where() take directly.exp = "($.vehicles.[0].make:STRING).upper()"use aerospike::expressions::{int_val, list_bin, string as str_exp, string_val, ExpType};use aerospike::expressions::{lists as list_exp, maps as map_exp};use aerospike::operations::string::{StringPolicy};use aerospike::{ListReturnType, MapReturnType};
let make = map_exp::get_by_key( MapReturnType::Value, ExpType::STRING, string_val("make".to_string()), list_exp::get_by_index( ListReturnType::Values, ExpType::MAP, int_val(0), list_bin("vehicles".to_string()), &[]), &[]);
let exp = str_exp::upper(&StringPolicy::default(), make);using Aerospike.Client;
Exp make = MapExp.GetByKey(MapReturnType.VALUE, Exp.Type.STRING, Exp.Val("make"), ListExp.GetByIndex(ListReturnType.VALUE, Exp.Type.MAP, Exp.Val(0), Exp.ListBin("vehicles")));
Expression exp = Exp.Build(StringExp.Upper(StringPolicy.Default, make));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"make := as.ExpMapGetByKey(as.MapReturnType.VALUE, as.ExpTypeSTRING, as.ExpStringVal("make"), as.ExpListGetByIndex(as.ListReturnTypeValue, as.ExpTypeMAP, as.ExpIntVal(0), as.ExpListBin("vehicles")))
exp := as.ExpStringUpper(as.DefaultStringPolicy, make)const exp = Aerospike.expconst lists = Aerospike.listsconst maps = Aerospike.maps
const make = exp.maps.getByKey( exp.lists.getByIndex(exp.binList('vehicles'), exp.int(0), exp.type.MAP, lists.returnType.VALUE), exp.str('make'), exp.type.STR, maps.returnType.VALUE)
const expression = exp.string.upper(null, make)as_exp_build(predexp, as_exp_string_upper(NULL, as_exp_map_get_by_key(NULL, AS_MAP_RETURN_VALUE, AS_EXP_TYPE_STR, as_exp_str("make"), as_exp_list_get_by_index(NULL, AS_LIST_RETURN_VALUE, AS_EXP_TYPE_MAP, as_exp_int(0), as_exp_bin_list("vehicles")))));import com.aerospike.client.cdt.ListReturnType;import com.aerospike.client.cdt.MapReturnType;import com.aerospike.client.exp.ListExp;import com.aerospike.client.exp.MapExp;import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Exp make = MapExp.getByKey(MapReturnType.VALUE, Exp.Type.STRING, Exp.val("make"), ListExp.getByIndex(ListReturnType.VALUE, Exp.Type.MAP, Exp.val(0), Exp.listBin("vehicles")));
Expression exp = Exp.build(StringExp.upper(StringPolicy.Default, make));import aerospikefrom aerospike_helpers import expressions as exprsfrom aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
make = exprs.MapGetByKey( ctx=None, return_type=aerospike.MAP_RETURN_VALUE, value_type=exprs.ResultType.STRING, key=exprs.Val("make"), bin=exprs.ListGetByIndex( ctx=None, return_type=aerospike.LIST_RETURN_VALUE, value_type=exprs.ResultType.MAP, index=exprs.Val(0), bin=exprs.ListBin("vehicles"), ),)
exp = str_expr.Upper(StringPolicy(), bin=make).compile()Run it like any other expression on this page: as a filter, or as a computed bin through an operation expression.
In AEL the parentheses are load-bearing, and so is the :STRING pin. A string transform
applied to a path — $.vehicles.[0].make:STRING.upper() — is a modify terminal, and
evaluates to the whole vehicles list with that element transformed. Parenthesising the
path first makes it a value, so the expression evaluates to the string alone. Without the
type pin the server cannot infer the type and rejects the expression.
to_string is the one operation with no Operate API context path. Project the nested value with a list or map getter and pass it as the source expression.
Related guides
- String operations overview
- Compare String values
- Working with nested collection data types
- Upgrade to Database 8.2.0 and later
Modify
string_append(policy, value, bin)Returns the string with value added to the end. Unlike the append Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin. AEL text has no append function, and concatenates with the type-directed + operator instead. The Java, Python, and C helpers expose a named builder for consistency with the Operate API.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
value | string | Text to add to the end of the string. A single value, not a list. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
// AEL has no append function; it concatenates with +.String exp = "$.log:STRING + ' line'";# AEL has no append function; it concatenates with +.exp = "$.log:STRING + ' line'"use aerospike::expressions::{string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::append(&StringPolicy::default(), string_bin("log".into()), string_val(" line".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Append(StringPolicy.Default, Exp.Val(" line"), Exp.StringBin("log")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringAppend(as.DefaultStringPolicy, as.ExpStringBin("log"), as.ExpStringVal(" line"))const exp = Aerospike.exp
const expression = exp.string.append(null, ' line', exp.binStr('log'))as_exp_build(predexp, as_exp_string_append(NULL, " line", as_exp_bin_str("log")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.append(StringPolicy.Default, Exp.val(" line"), Exp.stringBin("log")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Append(StringPolicy(), value=" line", bin="log").compile()string_case_fold(policy, bin)Returns the Unicode case-folded form of a string expression, for case-insensitive comparison. Unlike the case_fold Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.name:STRING.caseFold()";exp = "$.name:STRING.caseFold()"use aerospike::expressions::{string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::case_fold(&StringPolicy::default(), string_bin("name".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.CaseFold(StringPolicy.Default, Exp.StringBin("name")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringCaseFold(as.DefaultStringPolicy, as.ExpStringBin("name"))const exp = Aerospike.exp
const expression = exp.string.caseFold(null, exp.binStr('name'))as_exp_build(predexp, as_exp_string_case_fold(NULL, as_exp_bin_str("name")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.caseFold(StringPolicy.Default, Exp.stringBin("name")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.CaseFold(StringPolicy(), bin="name").compile()string_concat(policy, values, bin)Returns the string with values joined onto the end, in order. Unlike the concat Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin. AEL text has no concat function, and concatenates with the type-directed + operator instead. The Java, Python, and C helpers expose a named builder for consistency with the Operate API.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
values | any | A list of strings to join onto the end, in order. The server operation always takes a list, so a single-value caller wraps it in a one-element list. Python accepts a list only, and the C client also provides a single-value form, |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
// AEL has no concat function; it concatenates with +.String exp = "$.tags:STRING + 'extra'";# AEL has no concat function; it concatenates with +.exp = "$.tags:STRING + 'extra'"use aerospike::expressions::{list_val, string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};use aerospike::Value;
let exp = str_exp::concat(&StringPolicy::default(), string_bin("tags".into()), list_val(vec![Value::from("extra")]));using System.Collections.Generic;using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Concat(StringPolicy.Default, Exp.Val(new List<string> { "extra" }), Exp.StringBin("tags")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringConcat(as.DefaultStringPolicy, as.ExpStringBin("tags"), as.ExpListVal(as.StringValue("extra")))const exp = Aerospike.exp
const expression = exp.string.concat(null, 'extra', exp.binStr('tags'))as_exp_build(predexp, as_exp_string_concat(NULL, "extra", as_exp_bin_str("tags")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;import java.util.List;
Expression exp = Exp.build( StringExp.concat(StringPolicy.Default, Exp.val(List.of("extra")), Exp.stringBin("tags")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Concat( StringPolicy(), values=["extra"], bin="tags").compile()string_insert(policy, offset, value, bin)Returns the string with value inserted at codepoint offset. Unlike the insert Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin. AEL text calls this splice to disambiguate from the list and map insert functions. The Java, Python, and C helpers keep the insert name for consistency with the Operate API.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
offset | integer | Codepoint index at which to insert. Negative values count from the end of the string. Out-of-range values are clamped to |
value | string | Text to insert. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
// insert is splice in AEL, to avoid the list and map insert.String exp = "$.text:STRING.splice(offset: 1, value: 'oh')";# insert is splice in AEL, to avoid the list and map insert.exp = "$.text:STRING.splice(offset: 1, value: 'oh')"use aerospike::expressions::{int_val, string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::insert(&StringPolicy::default(), string_bin("text".into()), int_val(1), string_val("oh".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Insert(StringPolicy.Default, Exp.Val(1), Exp.Val("oh"), Exp.StringBin("text")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringInsert(as.DefaultStringPolicy, as.ExpStringBin("text"), as.ExpIntVal(1), as.ExpStringVal("oh"))const exp = Aerospike.exp
const expression = exp.string.insert(null, 1, 'oh', exp.binStr('text'))as_exp_build(predexp, as_exp_string_insert(NULL, 1, "oh", as_exp_bin_str("text")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.insert(StringPolicy.Default, Exp.val(1), Exp.val("oh"), Exp.stringBin("text")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Insert( StringPolicy(), index=1, value="oh", bin="text").compile()string_lower(policy, bin)Returns the lowercase form of a string expression. Unlike the lower Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.email:STRING.lower()";exp = "$.email:STRING.lower()"use aerospike::expressions::{string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::lower(&StringPolicy::default(), string_bin("email".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Lower(StringPolicy.Default, Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringLower(as.DefaultStringPolicy, as.ExpStringBin("email"))const exp = Aerospike.exp
const expression = exp.string.lower(null, exp.binStr('email'))as_exp_build(predexp, as_exp_string_lower(NULL, as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.lower(StringPolicy.Default, Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Lower(StringPolicy(), bin="email").compile()string_normalize_nfc(policy, bin)Returns the Unicode NFC-normalized form of a string expression. Already-normalized strings are unchanged. Unlike the normalize_nfc Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin. Use this so mixed NFC and NFD spellings compare equal under eq. See Compare String values.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.name:STRING.normalizeNFC()";exp = "$.name:STRING.normalizeNFC()"use aerospike::expressions::{string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::normalize_nfc(&StringPolicy::default(), string_bin("name".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.NormalizeNFC(StringPolicy.Default, Exp.StringBin("name")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringNormalizeNFC(as.DefaultStringPolicy, as.ExpStringBin("name"))const exp = Aerospike.exp
const expression = exp.string.normalizeNfc(null, exp.binStr('name'))as_exp_build(predexp, as_exp_string_normalize_nfc(NULL, as_exp_bin_str("name")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.normalizeNFC(StringPolicy.Default, Exp.stringBin("name")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.NormalizeNFC(StringPolicy(), bin="name").compile()string_overwrite(policy, offset, value, bin)Returns the string with the codepoint range starting at offset overwritten by value. The result grows beyond the original length when value extends past the end. Unlike the overwrite Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
offset | integer | Codepoint index at which to start overwriting. Negative values count from the end of the string, as they do for |
value | string | Replacement text. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.text:STRING.overwrite(offset: 4, value: 'bleh')";exp = "$.text:STRING.overwrite(offset: 4, value: 'bleh')"use aerospike::expressions::{int_val, string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::overwrite(&StringPolicy::default(), string_bin("text".into()), int_val(4), string_val("bleh".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Overwrite(StringPolicy.Default, Exp.Val(4), Exp.Val("bleh"), Exp.StringBin("text")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringOverwrite(as.DefaultStringPolicy, as.ExpStringBin("text"), as.ExpIntVal(4), as.ExpStringVal("bleh"))const exp = Aerospike.exp
const expression = exp.string.overwrite(null, 4, 'bleh', exp.binStr('text'))as_exp_build(predexp, as_exp_string_overwrite(NULL, 4, "bleh", as_exp_bin_str("text")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.overwrite(StringPolicy.Default, Exp.val(4), Exp.val("bleh"), Exp.stringBin("text")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Overwrite( StringPolicy(), index=4, value="bleh", bin="text").compile()string_pad_end(policy, target_length, pad_string, bin)Returns the string padded at the end to target_length using pad_string. No change is made when the source is already at or above the target length. Unlike the pad_end Operate API operation, the expression form yields the padded string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
target_length | integer | Minimum codepoint length after padding. |
pad_string | string | Padding string. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.id:STRING.padEnd(length: 6, pad: '0')";exp = "$.id:STRING.padEnd(length: 6, pad: '0')"use aerospike::expressions::{int_val, string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::pad_end(&StringPolicy::default(), string_bin("id".into()), int_val(6), string_val("0".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.PadEnd(StringPolicy.Default, Exp.Val(6), Exp.Val("0"), Exp.StringBin("id")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringPadEnd(as.DefaultStringPolicy, as.ExpStringBin("id"), as.ExpIntVal(6), as.ExpStringVal("0"))const exp = Aerospike.exp
const expression = exp.string.padEnd(null, 6, '0', exp.binStr('id'))as_exp_build(predexp, as_exp_string_pad_end(NULL, 6, "0", as_exp_bin_str("id")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.padEnd(StringPolicy.Default, Exp.val(6), Exp.val("0"), Exp.stringBin("id")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.PadEnd( StringPolicy(), target_length=6, pad_string="0", bin="id").compile()string_pad_start(policy, target_length, pad_string, bin)Returns the string padded at the start to target_length using pad_string. No change is made when the source is already at or above the target length. Unlike the pad_start Operate API operation, the expression form yields the padded string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
target_length | integer | Minimum codepoint length after padding. |
pad_string | string | Padding string. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.id:STRING.padStart(length: 6, pad: '0')";exp = "$.id:STRING.padStart(length: 6, pad: '0')"use aerospike::expressions::{int_val, string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::pad_start(&StringPolicy::default(), string_bin("id".into()), int_val(6), string_val("0".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.PadStart(StringPolicy.Default, Exp.Val(6), Exp.Val("0"), Exp.StringBin("id")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringPadStart(as.DefaultStringPolicy, as.ExpStringBin("id"), as.ExpIntVal(6), as.ExpStringVal("0"))const exp = Aerospike.exp
const expression = exp.string.padStart(null, 6, '0', exp.binStr('id'))as_exp_build(predexp, as_exp_string_pad_start(NULL, 6, "0", as_exp_bin_str("id")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.padStart(StringPolicy.Default, Exp.val(6), Exp.val("0"), Exp.stringBin("id")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.PadStart( StringPolicy(), target_length=6, pad_string="0", bin="id").compile()string_prepend(policy, value, bin)Returns the string with value added to the start. Unlike the prepend Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin. AEL text has no prepend function, and concatenates with the type-directed + operator instead. The Java, Python, and C helpers expose a named builder for consistency with the Operate API.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
value | string | Text to add to the start of the string. A single value, not a list. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
// AEL has no prepend function; it concatenates with +.String exp = "'prefix: ' + $.log:STRING";# AEL has no prepend function; it concatenates with +.exp = "'prefix: ' + $.log:STRING"use aerospike::expressions::{string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::prepend(&StringPolicy::default(), string_bin("log".into()), string_val("prefix: ".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Prepend(StringPolicy.Default, Exp.Val("prefix: "), Exp.StringBin("log")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringPrepend(as.DefaultStringPolicy, as.ExpStringBin("log"), as.ExpStringVal("prefix: "))const exp = Aerospike.exp
const expression = exp.string.prepend(null, 'prefix: ', exp.binStr('log'))as_exp_build(predexp, as_exp_string_prepend(NULL, "prefix: ", as_exp_bin_str("log")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.prepend(StringPolicy.Default, Exp.val("prefix: "), Exp.stringBin("log")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Prepend( StringPolicy(), value="prefix: ", bin="log").compile()string_regex_replace(policy, pattern, replacement, regex_flags, bin)Returns the string with the first regex match replaced by replacement, or every match when the GLOBAL flag is set. Unlike the regex_replace Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write regex_flags for the transform. Optional, and defaults to none. With |
pattern | string literal | Regular expression pattern. |
replacement | string literal | Replacement text. |
regex_flags | integer literal | Bit field of regex regex_flags on the six client-builder tabs, combinable with bitwise OR. Defaults to none, which replaces only the first match; |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Without GLOBAL, only the first match is replaced. Every client takes the policy first, the operands next, and the source string last.
// The /g flag replaces every match; without it only the first is replaced.String exp = "$.text:STRING.regexReplace(pattern: /\\d+/g, replace: '')";# The /g flag replaces every match; without it only the first is replaced.exp = r"$.text:STRING.regexReplace(pattern: /\d+/g, replace: '')"use aerospike::expressions::{string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringPolicy, StringRegexFlags};
let exp = str_exp::regex_replace(&StringPolicy::default(), string_bin("text".into()), string_val(r"\d+".into()), string_val("".into()), StringRegexFlags::GLOBAL);using Aerospike.Client;
Expression exp = Exp.Build( StringExp.RegexReplace(StringPolicy.Default, Exp.Val(@"\d+"), Exp.Val(""), StringRegexFlags.GLOBAL, Exp.StringBin("text")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringRegexReplace(as.DefaultStringPolicy, as.ExpStringBin("text"), as.ExpStringVal(`\d+`), as.ExpStringVal(""), as.StringRegexGlobal)const exp = Aerospike.expconst strings = Aerospike.strings
const expression = exp.string.regexReplace(null, '\\d+', '', strings.regexFlags.GLOBAL, exp.binStr('text'))as_exp_build(predexp, as_exp_string_regex_replace(NULL, "\\d+", "", AS_STRING_REGEX_FLAGS_GLOBAL, as_exp_bin_str("text")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;import com.aerospike.client.operation.StringRegexFlags;
Expression exp = Exp.build( StringExp.regexReplace(StringPolicy.Default, Exp.val("\\d+"), Exp.val(""), StringRegexFlags.GLOBAL, Exp.stringBin("text")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy, RegexFlags
exp = str_expr.RegexReplace( StringPolicy(), pattern=r"\d+", replacement="", regex_flags=RegexFlags.GLOBAL, bin="text").compile()string_repeat(policy, count, bin)Returns the string repeated count times. Unlike the repeat Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
count | integer | Number of times to repeat the string. Must be non-negative. A negative count returns an error. A count of |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.unit:STRING.repeat(3)";exp = "$.unit:STRING.repeat(3)"use aerospike::expressions::{int_val, string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::repeat(&StringPolicy::default(), string_bin("unit".into()), int_val(3));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Repeat(StringPolicy.Default, Exp.Val(3), Exp.StringBin("unit")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringRepeat(as.DefaultStringPolicy, as.ExpStringBin("unit"), as.ExpIntVal(3))const exp = Aerospike.exp
const expression = exp.string.repeat(null, 3, exp.binStr('unit'))as_exp_build(predexp, as_exp_string_repeat(NULL, 3, as_exp_bin_str("unit")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.repeat(StringPolicy.Default, Exp.val(3), Exp.stringBin("unit")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Repeat(StringPolicy(), count=3, bin="unit").compile()string_replace(policy, find, replace, bin)Returns the string with the first occurrence of find replaced by replace. Unlike the replace Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
find | string literal | Substring to replace. |
replace | string literal | Replacement text. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.msg:STRING.replace(find: 'old', replace: 'new')";exp = "$.msg:STRING.replace(find: 'old', replace: 'new')"use aerospike::expressions::{string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::replace(&StringPolicy::default(), string_bin("msg".into()), string_val("old".into()), string_val("new".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Replace(StringPolicy.Default, Exp.Val("old"), Exp.Val("new"), Exp.StringBin("msg")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringReplace(as.DefaultStringPolicy, as.ExpStringBin("msg"), as.ExpStringVal("old"), as.ExpStringVal("new"))const exp = Aerospike.exp
const expression = exp.string.replace(null, 'old', 'new', exp.binStr('msg'))as_exp_build(predexp, as_exp_string_replace(NULL, "old", "new", as_exp_bin_str("msg")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.replace(StringPolicy.Default, Exp.val("old"), Exp.val("new"), Exp.stringBin("msg")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Replace( StringPolicy(), needle="old", replacement="new", bin="msg").compile()string_replace_all(policy, find, replace, bin)Returns the string with every occurrence of find replaced by replace. Unlike the replace_all Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
find | string literal | Substring to replace. |
replace | string literal | Replacement text. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.msg:STRING.replaceAll(find: 'old', replace: 'new')";exp = "$.msg:STRING.replaceAll(find: 'old', replace: 'new')"use aerospike::expressions::{string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::replace_all(&StringPolicy::default(), string_bin("msg".into()), string_val("old".into()), string_val("new".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.ReplaceAll(StringPolicy.Default, Exp.Val("old"), Exp.Val("new"), Exp.StringBin("msg")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringReplaceAll(as.DefaultStringPolicy, as.ExpStringBin("msg"), as.ExpStringVal("old"), as.ExpStringVal("new"))const exp = Aerospike.exp
const expression = exp.string.replaceAll(null, 'old', 'new', exp.binStr('msg'))as_exp_build(predexp, as_exp_string_replace_all(NULL, "old", "new", as_exp_bin_str("msg")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.replaceAll(StringPolicy.Default, Exp.val("old"), Exp.val("new"), Exp.stringBin("msg")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.ReplaceAll( StringPolicy(), needle="old", replacement="new", bin="msg").compile()string_snip(policy, from[, to], bin)Returns the string with the codepoint range from from (inclusive) to to (exclusive) removed. Unlike the snip Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
from | integer | Start codepoint index (inclusive). Negative values count from the end of the string. Out-of-range values are clamped to |
to | integer | End codepoint index (exclusive). Negative values count from the end of the string. Out-of-range values are clamped to |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.text:STRING.snip(from: 6, to: 9)";exp = "$.text:STRING.snip(from: 6, to: 9)"use aerospike::expressions::{int_val, string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::snip(&StringPolicy::default(), string_bin("text".into()), int_val(6), int_val(9));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Snip(StringPolicy.Default, Exp.Val(6), Exp.Val(9), Exp.StringBin("text")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringSnip(as.DefaultStringPolicy, as.ExpStringBin("text"), as.ExpIntVal(6), as.ExpIntVal(9))const exp = Aerospike.exp
const expression = exp.string.snip(null, 6, 9, exp.binStr('text'))as_exp_build(predexp, as_exp_string_snip(NULL, 6, 9, as_exp_bin_str("text")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.snip(StringPolicy.Default, Exp.val(6), Exp.val(9), Exp.stringBin("text")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Snip(StringPolicy(), start=6, end=9, bin="text").compile()string_trim(policy, bin)Returns the string with leading and trailing Unicode whitespace removed. Unlike the trim Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.email:STRING.trim()";exp = "$.email:STRING.trim()"use aerospike::expressions::{string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::trim(&StringPolicy::default(), string_bin("email".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Trim(StringPolicy.Default, Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringTrim(as.DefaultStringPolicy, as.ExpStringBin("email"))const exp = Aerospike.exp
const expression = exp.string.trim(null, exp.binStr('email'))as_exp_build(predexp, as_exp_string_trim(NULL, as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.trim(StringPolicy.Default, Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Trim(StringPolicy(), bin="email").compile()string_trim_end(policy, bin)Returns the string with trailing Unicode whitespace removed. Unlike the trim_end Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.email:STRING.trimEnd()";exp = "$.email:STRING.trimEnd()"use aerospike::expressions::{string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::trim_end(&StringPolicy::default(), string_bin("email".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.TrimEnd(StringPolicy.Default, Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringTrimEnd(as.DefaultStringPolicy, as.ExpStringBin("email"))const exp = Aerospike.exp
const expression = exp.string.trimEnd(null, exp.binStr('email'))as_exp_build(predexp, as_exp_string_trim_end(NULL, as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.trimEnd(StringPolicy.Default, Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.TrimEnd(StringPolicy(), bin="email").compile()string_trim_start(policy, bin)Returns the string with leading Unicode whitespace removed. Unlike the trim_start Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.email:STRING.trimStart()";exp = "$.email:STRING.trimStart()"use aerospike::expressions::{string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::trim_start(&StringPolicy::default(), string_bin("email".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.TrimStart(StringPolicy.Default, Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringTrimStart(as.DefaultStringPolicy, as.ExpStringBin("email"))const exp = Aerospike.exp
const expression = exp.string.trimStart(null, exp.binStr('email'))as_exp_build(predexp, as_exp_string_trim_start(NULL, as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.trimStart(StringPolicy.Default, Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.TrimStart(StringPolicy(), bin="email").compile()string_upper(policy, bin)Returns the uppercase form of a string expression. Unlike the upper Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.
| Name | Type | Description |
|---|---|---|
policy | String policy | Write flags for the transform. Optional, and defaults to none. With |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.
String exp = "$.name:STRING.upper()";exp = "$.name:STRING.upper()"use aerospike::expressions::{string as str_exp, string_bin};use aerospike::operations::string::{StringPolicy};
let exp = str_exp::upper(&StringPolicy::default(), string_bin("name".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Upper(StringPolicy.Default, Exp.StringBin("name")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringUpper(as.DefaultStringPolicy, as.ExpStringBin("name"))const exp = Aerospike.exp
const expression = exp.string.upper(null, exp.binStr('name'))as_exp_build(predexp, as_exp_string_upper(NULL, as_exp_bin_str("name")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringPolicy;
Expression exp = Exp.build( StringExp.upper(StringPolicy.Default, Exp.stringBin("name")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import StringPolicy
exp = str_expr.Upper(StringPolicy(), bin="name").compile()Read
string_b64_decode(bin)Decodes a base64-encoded string expression into a Blob.
| Name | Type | Description |
|---|---|---|
bin | string | String bin to operate on, or any expression that evaluates to a string. |
blob Compose string expressions in query filters or operate read projections.
String exp = "$.encoded:STRING.b64Decode()";exp = "$.encoded:STRING.b64Decode()"use aerospike::expressions::{string as str_exp, string_bin};
let exp = str_exp::b64_decode(string_bin("encoded".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.B64Decode(Exp.StringBin("encoded")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringB64Decode(as.ExpStringBin("encoded"))const exp = Aerospike.exp
const expression = exp.string.b64Decode(exp.binStr('encoded'))as_exp_build(predexp, as_exp_string_b64_decode(as_exp_bin_str("encoded")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.b64Decode(Exp.stringBin("encoded")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.Base64Decode(bin="encoded").compile()string_byte_length(bin)Returns the number of UTF-8 bytes in a string expression.
| Name | Type | Description |
|---|---|---|
bin | string | String bin to operate on, or any expression that evaluates to a string. |
integer Compose string expressions in query filters or operate read projections.
// byte_length is bytesLength in AEL.String exp = "$.email:STRING.bytesLength()";# byte_length is bytesLength in AEL.exp = "$.email:STRING.bytesLength()"use aerospike::expressions::{string as str_exp, string_bin};
let exp = str_exp::byte_length(string_bin("email".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.ByteLength(Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringByteLength(as.ExpStringBin("email"))const exp = Aerospike.exp
const expression = exp.string.byteLength(exp.binStr('email'))as_exp_build(predexp, as_exp_string_byte_length(as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.byteLength(Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.ByteLength(bin="email").compile()string_char_at(index, bin)Returns the single-codepoint substring at index from a string expression. Negative values count from the end of the string.
| Name | Type | Description |
|---|---|---|
index | integer | Codepoint index. Negative values count from the end of the string, so |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.
String exp = "$.email:STRING.charAt(index: -1)";exp = "$.email:STRING.charAt(index: -1)"use aerospike::expressions::{int_val, string as str_exp, string_bin};
let exp = str_exp::char_at(string_bin("email".into()), int_val(-1));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.CharAt(Exp.Val(-1), Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringCharAt(as.ExpStringBin("email"), as.ExpIntVal(-1))const exp = Aerospike.exp
const expression = exp.string.charAt(-1, exp.binStr('email'))as_exp_build(predexp, as_exp_string_char_at(-1, as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.charAt(Exp.val(-1), Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.CharAt(index=-1, bin="email").compile()string_contains(needle, bin)Returns whether a string expression contains needle, respecting Unicode canonical equivalence.
| Name | Type | Description |
|---|---|---|
needle | string | Substring to search for. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
boolean Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.
String exp = "$.email:STRING.contains(needle: '@company.com')";exp = "$.email:STRING.contains(needle: '@company.com')"use aerospike::expressions::{string as str_exp, string_bin, string_val};
let exp = str_exp::contains(string_bin("email".into()), string_val("@company.com".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Contains(Exp.Val("@company.com"), Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringContains(as.ExpStringBin("email"), as.ExpStringVal("@company.com"))const exp = Aerospike.exp
const expression = exp.string.contains('@company.com', exp.binStr('email'))as_exp_build(predexp, as_exp_string_contains("@company.com", as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.contains(Exp.val("@company.com"), Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.Contains(needle="@company.com", bin="email").compile()string_ends_with(suffix, bin)Returns whether a string expression ends with suffix.
| Name | Type | Description |
|---|---|---|
suffix | string | Substring the value must end with. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
boolean Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.
String exp = "$.email:STRING.endsWith('.com')";exp = "$.email:STRING.endsWith('.com')"use aerospike::expressions::{string as str_exp, string_bin, string_val};
let exp = str_exp::ends_with(string_bin("email".into()), string_val(".com".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.EndsWith(Exp.Val(".com"), Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringEndsWith(as.ExpStringBin("email"), as.ExpStringVal(".com"))const exp = Aerospike.exp
const expression = exp.string.endsWith('.com', exp.binStr('email'))as_exp_build(predexp, as_exp_string_ends_with(".com", as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.endsWith(Exp.val(".com"), Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.EndsWith(suffix=".com", bin="email").compile()string_find(needle[, occurrence], bin)Returns the codepoint index of needle in a string expression, or -1 if not found.
| Name | Type | Description |
|---|---|---|
needle | string | Substring to search for. |
occurrence | integer | 1-based match number. Negative values count from the end of the string. Must be non-zero. Optional, and defaults to |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
integer Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.
String exp = "$.email:STRING.find(needle: '@', occurrence: 1)";exp = "$.email:STRING.find(needle: '@', occurrence: 1)"use aerospike::expressions::{int_val, string as str_exp, string_bin, string_val};
let exp = str_exp::find_nth(string_bin("email".into()), string_val("@".into()), int_val(1));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Find(Exp.Val("@"), Exp.Val(1), Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringFindNth(as.ExpStringBin("email"), as.ExpStringVal("@"), as.ExpIntVal(1))const exp = Aerospike.exp
const expression = exp.string.findOccurrence('@', 1, exp.binStr('email'))as_exp_build(predexp, as_exp_string_find_occurrence("@", 1, as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.find(Exp.val("@"), Exp.val(1), Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.Find(needle="@", occurrence=1, bin="email").compile()string_is_lower(bin)Returns whether a string expression is lowercase: it holds no uppercase letter and at least one lowercase letter. Digits, spaces, and punctuation are ignored rather than counted against the value, so a non-empty value holding no cased letter returns false. An empty string returns true.
| Name | Type | Description |
|---|---|---|
bin | string | String bin to operate on, or any expression that evaluates to a string. |
boolean Compose string expressions in query filters or operate read projections.
String exp = "$.code:STRING.isLower()";exp = "$.code:STRING.isLower()"use aerospike::expressions::{string as str_exp, string_bin};
let exp = str_exp::is_lower(string_bin("code".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.IsLower(Exp.StringBin("code")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringIsLower(as.ExpStringBin("code"))const exp = Aerospike.exp
const expression = exp.string.isLower(exp.binStr('code'))as_exp_build(predexp, as_exp_string_is_lower(as_exp_bin_str("code")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.isLower(Exp.stringBin("code")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.IsLower(bin="code").compile()string_is_numeric([numeric_type, ]bin)Returns whether a string expression belongs to the requested numeric class.
| Name | Type | Description |
|---|---|---|
numeric_type | integer literal | Numeric class to test for: |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
boolean Compose string expressions in query filters or operate read projections. Most clients take the operand first and the source string last, while Go and Rust take the source string first. Float-class matching requires a literal ., so scientific-notation literals such as 1e5 match none of the three classes, including ANY.
String exp = "$.amount:STRING.isNumeric()";exp = "$.amount:STRING.isNumeric()"use aerospike::expressions::{string as str_exp, string_bin};use aerospike::operations::string::{StringNumericType};
let exp = str_exp::is_numeric_typed(string_bin("amount".into()), StringNumericType::Any);using Aerospike.Client;
Expression exp = Exp.Build( StringExp.IsNumeric(StringNumericType.ANY, Exp.StringBin("amount")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringIsNumericTyped(as.ExpStringBin("amount"), as.StringNumericAny)const exp = Aerospike.exp
const expression = exp.string.isNumeric(exp.binStr('amount'))as_exp_build(predexp, as_exp_string_is_numeric_type(AS_STRING_NUMERIC_ANY, as_exp_bin_str("amount")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringNumericType;
Expression exp = Exp.build( StringExp.isNumeric(StringNumericType.ANY, Exp.stringBin("amount")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import NumericType
exp = str_expr.IsNumeric(numeric_type=NumericType.ANY, bin="amount").compile()string_is_upper(bin)Returns whether a string expression is uppercase: it holds no lowercase letter and at least one uppercase letter. Digits, spaces, and punctuation are ignored rather than counted against the value, so a non-empty value holding no cased letter returns false. An empty string returns true.
| Name | Type | Description |
|---|---|---|
bin | string | String bin to operate on, or any expression that evaluates to a string. |
boolean Compose string expressions in query filters or operate read projections.
String exp = "$.code:STRING.isUpper()";exp = "$.code:STRING.isUpper()"use aerospike::expressions::{string as str_exp, string_bin};
let exp = str_exp::is_upper(string_bin("code".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.IsUpper(Exp.StringBin("code")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringIsUpper(as.ExpStringBin("code"))const exp = Aerospike.exp
const expression = exp.string.isUpper(exp.binStr('code'))as_exp_build(predexp, as_exp_string_is_upper(as_exp_bin_str("code")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.isUpper(Exp.stringBin("code")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.IsUpper(bin="code").compile()string_regex_compare(pattern, regex_flags, bin)Returns whether a string expression matches pattern, using ICU regular expression syntax. Prefer over legacy cmp_regex.
| Name | Type | Description |
|---|---|---|
pattern | string | ICU regular expression to match. It is evaluated per record, so it can come from a bin or from another expression, not only from a constant. |
regex_flags | integer literal | Bit field of regex regex_flags on the six client-builder tabs, combinable with bitwise OR; |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
boolean Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Python is the exception here, taking the source second, as in RegexCompare(pattern, bin, regex_flags).
// AEL has no regex_compare function; it matches with =~ and a regex literal.String exp = "$.phone:STRING =~ /^555.*/";# AEL has no regex_compare function; it matches with =~ and a regex literal.exp = "$.phone:STRING =~ /^555.*/"use aerospike::expressions::{string as str_exp, string_bin, string_val};use aerospike::operations::string::{StringRegexFlags};
let exp = str_exp::regex_compare_with_flags(string_bin("phone".into()), string_val("^555.*".into()), StringRegexFlags::DEFAULT);using Aerospike.Client;
Expression exp = Exp.Build( StringExp.RegexCompare(Exp.Val("^555.*"), StringRegexFlags.DEFAULT, Exp.StringBin("phone")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringRegexCompareWithFlags(as.ExpStringBin("phone"), as.ExpStringVal("^555.*"), as.StringRegexDefault)const exp = Aerospike.exp
const expression = exp.string.regexCompare('^555.*', exp.binStr('phone'))as_exp_build(predexp, as_exp_string_regex_compare_flags("^555.*", AS_STRING_REGEX_FLAGS_NONE, as_exp_bin_str("phone")));import com.aerospike.client.exp.StringExp;import com.aerospike.client.operation.StringRegexFlags;
Expression exp = Exp.build( StringExp.regexCompare(Exp.val("^555.*"), StringRegexFlags.DEFAULT, Exp.stringBin("phone")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.string_helpers import RegexFlags
exp = str_expr.RegexCompare( pattern="^555.*", bin="phone", regex_flags=RegexFlags.DEFAULT).compile()string_split([separator, ]bin)Returns a list of strings by splitting a string expression on separator.
| Name | Type | Description |
|---|---|---|
separator | string | Delimiter string. Optional. When omitted, the string is split into one element per Unicode codepoint rather than returned unsplit. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
list Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.
String exp = "$.tags:STRING.split(',')";exp = "$.tags:STRING.split(',')"use aerospike::expressions::{string as str_exp, string_bin, string_val};
let exp = str_exp::split_by_separator(string_bin("tags".into()), string_val(",".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Split(Exp.Val(","), Exp.StringBin("tags")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringSplitBySeparator(as.ExpStringBin("tags"), as.ExpStringVal(","))const exp = Aerospike.exp
const expression = exp.string.splitSeparator(',', exp.binStr('tags'))as_exp_build(predexp, as_exp_string_split_separator(",", as_exp_bin_str("tags")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.split(Exp.val(","), Exp.stringBin("tags")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.SplitSeparator(separator=",", bin="tags").compile()string_starts_with(prefix, bin)Returns whether a string expression starts with prefix.
| Name | Type | Description |
|---|---|---|
prefix | string | Substring the value must begin with. |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
boolean Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.
String exp = "$.sku:STRING.startsWith('A-')";exp = "$.sku:STRING.startsWith('A-')"use aerospike::expressions::{string as str_exp, string_bin, string_val};
let exp = str_exp::starts_with(string_bin("sku".into()), string_val("A-".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.StartsWith(Exp.Val("A-"), Exp.StringBin("sku")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringStartsWith(as.ExpStringBin("sku"), as.ExpStringVal("A-"))const exp = Aerospike.exp
const expression = exp.string.startsWith('A-', exp.binStr('sku'))as_exp_build(predexp, as_exp_string_starts_with("A-", as_exp_bin_str("sku")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.startsWith(Exp.val("A-"), Exp.stringBin("sku")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.StartsWith(prefix="A-", bin="sku").compile()string_strlen(bin)Returns the codepoint length of a string expression.
| Name | Type | Description |
|---|---|---|
bin | string | String bin to operate on, or any expression that evaluates to a string. |
integer Compose string expressions in query filters or operate read projections.
String exp = "$.name:STRING.strlen()";exp = "$.name:STRING.strlen()"use aerospike::expressions::{string as str_exp, string_bin};
let exp = str_exp::strlen(string_bin("name".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Strlen(Exp.StringBin("name")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringLen(as.ExpStringBin("name"))const exp = Aerospike.exp
const expression = exp.string.strlen(exp.binStr('name'))as_exp_build(predexp, as_exp_string_strlen(as_exp_bin_str("name")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.strlen(Exp.stringBin("name")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.StrLen(bin="name").compile()string_substr(from[, to], bin)Returns a substring by codepoint range from a string expression.
| Name | Type | Description |
|---|---|---|
from | integer | Start codepoint index (inclusive). Negative values count from the end of the string. Out-of-range values are clamped to |
to | integer | End codepoint index (exclusive). Negative values count from the end of the string. Out-of-range values are clamped to |
bin | string | String bin to operate on, or any expression that evaluates to a string. |
string Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.
String exp = "$.email:STRING.substr(from: 0, to: 10)";exp = "$.email:STRING.substr(from: 0, to: 10)"use aerospike::expressions::{int_val, string as str_exp, string_bin};
let exp = str_exp::substr_range(string_bin("email".into()), int_val(0), int_val(10));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.Substr(Exp.Val(0), Exp.Val(10), Exp.StringBin("email")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringSubstr(as.ExpStringBin("email"), as.ExpIntVal(0), as.ExpIntVal(10))const exp = Aerospike.exp
const expression = exp.string.substr(0, 10, exp.binStr('email'))as_exp_build(predexp, as_exp_string_substr_range(0, 10, as_exp_bin_str("email")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.substr(Exp.val(0), Exp.val(10), Exp.stringBin("email")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.SubStrRange(start=0, end=10, bin="email").compile()string_to_blob(bin)Returns the UTF-8 bytes of a string expression as a Blob.
| Name | Type | Description |
|---|---|---|
bin | string | String bin to operate on, or any expression that evaluates to a string. |
blob Compose string expressions in query filters or operate read projections.
String exp = "$.payload:STRING.toBlob()";exp = "$.payload:STRING.toBlob()"use aerospike::expressions::{string as str_exp, string_bin};
let exp = str_exp::to_blob(string_bin("payload".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.ToBlob(Exp.StringBin("payload")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringToBlob(as.ExpStringBin("payload"))const exp = Aerospike.exp
const expression = exp.string.toBlob(exp.binStr('payload'))as_exp_build(predexp, as_exp_string_to_blob(as_exp_bin_str("payload")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.toBlob(Exp.stringBin("payload")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.ToBlob(bin="payload").compile()string_to_double(bin)Parses a string expression as a float. Supports scientific notation.
| Name | Type | Description |
|---|---|---|
bin | string | String bin to operate on, or any expression that evaluates to a string. |
float Compose string expressions in query filters or operate read projections.
// to_double is toFloat in AEL.String exp = "$.rate:STRING.toFloat()";# to_double is toFloat in AEL.exp = "$.rate:STRING.toFloat()"use aerospike::expressions::{string as str_exp, string_bin};
let exp = str_exp::to_double(string_bin("rate".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.ToDouble(Exp.StringBin("rate")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringToDouble(as.ExpStringBin("rate"))const exp = Aerospike.exp
const expression = exp.string.toDouble(exp.binStr('rate'))as_exp_build(predexp, as_exp_string_to_double(as_exp_bin_str("rate")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.toDouble(Exp.stringBin("rate")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.ToDouble(bin="rate").compile()string_to_integer(bin)Parses a string expression as a signed integer.
| Name | Type | Description |
|---|---|---|
bin | string | String bin to operate on, or any expression that evaluates to a string. |
integer Compose string expressions in query filters or operate read projections.
// to_integer is toInt in AEL.String exp = "$.count:STRING.toInt()";# to_integer is toInt in AEL.exp = "$.count:STRING.toInt()"use aerospike::expressions::{string as str_exp, string_bin};
let exp = str_exp::to_integer(string_bin("count".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.ToInteger(Exp.StringBin("count")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringToInteger(as.ExpStringBin("count"))const exp = Aerospike.exp
const expression = exp.string.toInteger(exp.binStr('count'))as_exp_build(predexp, as_exp_string_to_integer(as_exp_bin_str("count")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.toInteger(Exp.stringBin("count")));from aerospike_helpers.expressions import string as str_expr
exp = str_expr.ToInteger(bin="count").compile()Type conversion
to_string(value)Converts an integer, float, boolean, blob, or string expression to its string representation. Unlike the other entries on this page, to_string is a standalone expression operator rather than a member of the string expression module, which is why each client spells it without the module prefix.
| Name | Type | Description |
|---|---|---|
value | any | Integer, float, boolean, blob, or string expression to convert. |
string Compose string expressions in query filters or operate read projections.
// Pin the receiver type: toString formats whatever the bin holds.String exp = "$.numbin:INT.toString()";# Pin the receiver type: toString formats whatever the bin holds.exp = "$.numbin:INT.toString()"use aerospike::expressions::{int_bin, string as str_exp};
let exp = str_exp::to_string(int_bin("numbin".into()));using Aerospike.Client;
Expression exp = Exp.Build( StringExp.ToString(Exp.IntBin("numbin")));// Requires: import as "github.com/aerospike/aerospike-client-go/v8"exp := as.ExpStringToString(as.ExpIntBin("numbin"))const exp = Aerospike.exp
const expression = exp.string.toString(exp.binInt('numbin'))as_exp_build(predexp, as_exp_to_string(as_exp_bin_int("numbin")));import com.aerospike.client.exp.StringExp;
Expression exp = Exp.build( StringExp.toString(Exp.intBin("numbin")));from aerospike_helpers.expressions import string as str_exprfrom aerospike_helpers.expressions import IntBin
exp = str_expr.ToString(bin=IntBin("numbin")).compile()