# File lib/uri_template/rfc6570/expression.rb, line 244
    def cut(str,chars)
      if chars > 0
        md = Regexp.compile("\\A#{self.class::CHARACTER_CLASS[:class]}{0,#{chars.to_s}}", Utils::KCODE_UTF8).match(str)
        return md[0]
      else
        return str
      end
    end