operator in overloading



operator_in_overloading
Smart pascal source code
function DigitInInteger(d: Integer; n: Integer): Boolean; begin Result := Pos(IntToStr(d), IntToStr(n)) > 0; end; function DigitInFloat(d: Integer; n: Float): Boolean; begin Result := Pos(IntToStr(d), FloatToStr(n)) > 0; end; operator in (Integer, Integer): Boolean uses DigitInInteger; operator in (Integer, Float): Boolean uses DigitInFloat; WriteLn(1 in 123); WriteLn(4 in 123); WriteLn(5 in 123.5); WriteLn(4 in 123.5); WriteLn(1 not in 123); WriteLn(4 not in 123); WriteLn(5 not in 123.5); WriteLn(4 not in 123.5); {<<< RESULT - CONSOLE LOG >>> ----------------------------- True False True False False True False True ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}