lowercase()#
relationalai.std.strings
#lowercase(string: Producer) -> Expression
Converts a string to lowercase. Must be called in a rule or query context.
Parameters#
Name | Type | Description |
---|---|---|
string | Producer | A producer that produces string values. |
Returns#
An Expression
object that produce lowercase strings.
Example#
#import relationalai as rai
from relationalai.std.strings import lowercase
# Create a model named "people" with a Person type.
model = rai.Model("people")
Person = model.Type("Person")
# Add some people to the model.
with model.rule():
alice = Person.add(name="Alice")
bob = Person.add(name="Bob")
# Get all people whose name ends with "ice".
with model.query() as select:
person = Person()
name_lower = lowercase(person.name)
response = select(person.name, name_lower)
print(response.results)
# Output:
# name v
# 0 Alice alice
# 1 Bob bob