Diff for /parser3/src/classes/string.C between versions 1.267 and 1.268

version 1.267, 2026/04/25 13:38:46 version 1.268, 2026/11/01 14:41:57
Line 203  static void _pos(Request& r, MethodParam Line 203  static void _pos(Request& r, MethodParam
         r.write(*new VInt((int)string.pos(r.charsets.source(), substr.as_string(), offset)));          r.write(*new VInt((int)string.pos(r.charsets.source(), substr.as_string(), offset)));
 }  }
   
   static void _rpos(Request& r, MethodParams& params) {
           Value& substr=params.as_no_junction(0, "substr must not be code");
   
           const String& string=GET_SELF(r, VString).string();
           size_t offset=string.length(); // from the very end
           if(params.count()>1){
                   int n=params.as_int(1, "n must be int", r);
                   if(n<0)
                           throw Exception(PARSER_RUNTIME, 0, "n(%d) must be >=0", n);
                   offset=n;
           }
   
           r.write(*new VInt((int)string.rpos(r.charsets.source(), substr.as_string(), offset)));
   }
   
 struct Split_action_info {  struct Split_action_info {
         const String& src;          const String& src;
         ArrayString &result;          ArrayString &result;
Line 844  MString::MString(): Methoded("string") { Line 859  MString::MString(): Methoded("string") {
         add_native_method("mid", Method::CT_DYNAMIC, _mid, 1, 2);          add_native_method("mid", Method::CT_DYNAMIC, _mid, 1, 2);
   
         // ^string.pos[substr]          // ^string.pos[substr]
         // ^string.pos[substr](n)          // ^string.pos[substr](n) n is the position from which to search
         add_native_method("pos", Method::CT_DYNAMIC, _pos, 1, 2);          add_native_method("pos", Method::CT_DYNAMIC, _pos, 1, 2);
           add_native_method("lpos", Method::CT_DYNAMIC, _pos, 1, 2);
   
           // ^string.rpos[substr]
           // ^string.rpos[substr](n) n is the maximum position of the substr start, not substr end
           add_native_method("rpos", Method::CT_DYNAMIC, _rpos, 1, 2);
   
         // ^string.split[delim]          // ^string.split[delim]
         // ^string.split[delim][options]          // ^string.split[delim][options]

Removed from v.1.267  
changed lines
  Added in v.1.268


E-mail: