Пример #1
0
 public override AnyValue MapText(TextValue value)
 {
     if (value.Length() > _maxTextParameterLength)
     {
         return(Values.stringValue(value.StringValue().Substring(0, _maxTextParameterLength)));
     }
     return(value);
 }
Пример #2
0
 protected internal virtual TextValue AsUTF8StringValue(TextValue @in)
 {
     if (@in is UTF8StringValue)
     {
         return(@in);
     }
     else
     {
         return(utf8Value(@in.StringValue().GetBytes(UTF_8)));
     }
 }
Пример #3
0
        public static BooleanValue Regex(TextValue lhs, TextValue rhs)
        {
            string regexString = rhs.StringValue();

            try
            {
                bool matches = Pattern.compile(regexString).matcher(lhs.StringValue()).matches();
                return(matches ? TRUE : FALSE);
            }
            catch (PatternSyntaxException e)
            {
                throw new InvalidSemanticsException("Invalid Regex: " + e.Message);
            }
        }
Пример #4
0
        public static BooleanValue Regex(TextValue text, Pattern pattern)
        {
            bool matches = pattern.matcher(text.StringValue()).matches();

            return(matches ? TRUE : FALSE);
        }