KRL convert string to lowercase in pre block
Question
Is there a way in the pre block of a rule to convert a string to all lowe开发者_StackOverflowr case?
Background
I have a regular expression that returns parts of a string and sometimes they start with an uppercase and sometimes not. Because I want to use the result from the regex as a key in a hashmap I need the case to always be consistent.
Yup! lc()
is your friend. Rule example:
rule example {
select when somedomain someevent
pre {
x = "FOO";
y = x.lc();
}
noop();
}
Docs Link: http://docs.kynetx.com/docs/Lc
精彩评论