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 >>>>>>>>>}
function FloatToStr$_Float_(i) { return i.toString() }
function FloatToStr$_Float_Integer_(i,p) { return (p==99)?i.toString():i.toFixed(p) }
function WriteLn(value) {
if (window.console) { window.console.log(value); } };
function DigitInInteger(d, n) {
return (n.toString().indexOf(d.toString())+1)>0;
};
function DigitInFloat(d$1, n$1) {
return (FloatToStr$_Float_(n$1).indexOf(d$1.toString())+1)>0;
};
/* <<< main JS >>> */
WriteLn(DigitInInteger(1,123));
WriteLn(DigitInInteger(4,123));
WriteLn(DigitInFloat(5,123.5));
WriteLn(DigitInFloat(4,123.5));
WriteLn((!DigitInInteger(1,123)));
WriteLn((!DigitInInteger(4,123)));
WriteLn((!DigitInFloat(5,123.5)));
WriteLn((!DigitInFloat(4,123.5)));