--- parser3/src/classes/string.C 2007/11/14 09:45:21 1.157 +++ parser3/src/classes/string.C 2008/05/22 17:43:30 1.159 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_STRING_C="$Date: 2007/11/14 09:45:21 $"; +static const char * const IDENT_STRING_C="$Date: 2008/05/22 17:43:30 $"; #include "classes.h" #include "pa_vmethod_frame.h" @@ -96,7 +96,19 @@ static void _bool(Request& r, MethodPara throw Exception(PARSER_RUNTIME, 0, "parameter is empty string, error converting"); - converted=self_string.as_bool(); + + try { + converted=self_string.as_bool(); + } catch(...) { + const String& lower_string=self_string.change_case(r.charsets.source(), String::CC_LOWER); + if(lower_string == "true"){ + converted=true; + } else if (lower_string == "false"){ + converted=false; + } else { + rethrow; + } + } } catch(...) { // convert problem if(params.count()>0) converted=params.as_bool(0, "default must be bool", r); // (default) @@ -113,7 +125,7 @@ static void _bool(Request& r, MethodPara // for some time due to stupid {} in original design const String& fmt=r.process_to_string(fmt_maybe_code); - const char* buf=format(r.get_self().as_double(), fmt.cstrm()); + const char* buf=format(r.get_self().as_double(), fmt.trim().cstrm()); r.write_no_lang(String(buf)); } @@ -137,8 +149,7 @@ static void _right(Request& r, MethodPar 0, "n(%d) must be >=0", sn); size_t n=(size_t)sn; - - + const String& string=GET_SELF(r, VString).string(); size_t length=string.length(); r.write_assign_lang(n