Diff for /parser3/src/classes/string.C between versions 1.200 and 1.201

version 1.200, 2011/05/30 12:50:59 version 1.201, 2012/01/08 05:58:27
Line 605  static void _sql(Request& r, MethodParam Line 605  static void _sql(Request& r, MethodParam
 static void _replace(Request& r, MethodParams& params) {  static void _replace(Request& r, MethodParams& params) {
         const String& src=GET_SELF(r, VString).string();          const String& src=GET_SELF(r, VString).string();
   
         Table* table=params.as_no_junction(0, PARAM_MUST_NOT_BE_CODE).get_table();          if(params.count()==1) {
         if(!table)                  // ^string.replace[table]
                 throw Exception(PARSER_RUNTIME,                  Table* table=params.as_no_junction(0, PARAM_MUST_NOT_BE_CODE).get_table();
                         0,                  if(!table)
                         "parameter must be table");                          throw Exception(PARSER_RUNTIME,
                                   0,
                                   "parameter must be table");
                   Dictionary dict(*table);
                   r.write_assign_lang(src.replace(dict));
           } else {
                   // ^string.replace[from-string;to-string]
                   Dictionary dict(
                                                   params.as_string(0, "from must be string"),
                                                   params.as_string(1, "to must be string")
                                           );
                   r.write_assign_lang(src.replace(dict));
           }
   
         Dictionary dict(*table);  
         r.write_assign_lang(src.replace(dict));  
 }  }
   
 static void _save(Request& r, MethodParams& params) {  static void _save(Request& r, MethodParams& params) {
Line 782  MString::MString(): Methoded("string") { Line 792  MString::MString(): Methoded("string") {
         add_native_method("sql", Method::CT_STATIC, _sql, 1, 2);          add_native_method("sql", Method::CT_STATIC, _sql, 1, 2);
   
         // ^string.replace[table]          // ^string.replace[table]
         add_native_method("replace", Method::CT_DYNAMIC, _replace, 1, 1);          add_native_method("replace", Method::CT_DYNAMIC, _replace, 1, 2);
   
         // ^string.save[append][file]          // ^string.save[append][file]
         // ^string.save[file]          // ^string.save[file]

Removed from v.1.200  
changed lines
  Added in v.1.201


E-mail: