开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜