0 Members and 1 Guest are viewing this topic.
const D_Num=1;var NumType: integer;function strtobool(str: string; def: boolean):boolean;begin Result:=def; try NumType:=D_Num; Case NumType of 1: begin //Kavukamari if (strtoint(str) > 0) then Result:=true else if (strtoint(str) < 1) then Result:=false; end; 2: begin //DorkeyDear if (strtoint(str) = 1) then Result:=true else Result:=false; end; 3: begin //PerroAZUL/php if (strtoint(str) = 0) then Result:=false else Result:=true; end; end; except Case str of 'true','on','active','yes','enable','enabled','hi','hello': begin Result:=true; end; 'false','off','inactive','no','disable','disabled','bye','goodbuy','goodbye': begin Result:=false; end; end; end;end;function booltostr(bool: boolean):string;begin Case bool of true: Result:='true'; false: Result:='false'; end;end;
goodbuy!
that seems really confusing, especially the "bitwise NOT of 0 = true" part and the second part of the part about VB and Delphi...but if you understand what you're saying, you can always add it to the case statement
NOT 00000000 (false) ======= 11111111 (true)NOT 11111111 (true) ======= 00000000 (false)
NOT 00000000 (false) ======= 11111111AND 00000001 ======= 00000001 (true)NOT 00000001 (true) ======= 11111110AND 00000001 ======= 00000000 (false)
00000000 (false)XOR 00000001 ======= 00000001 (true) 00000001 (true)XOR 00000001 ======= 00000000 (false)
NOT 10101010 (true) ======= 01010101 (true)