Files
HDCApi/uCommons.pas
2025-05-21 21:14:32 +02:00

47 lines
850 B
ObjectPascal

unit uCommons;
interface
uses
System.SysUtils, System.StrUtils, System.Rtti;
type
EServiceException = class(Exception)
end;
function StrToNQuotedList (inStr: string): string;
function IsVal0Or1 (inStr: string): boolean;
implementation
function StrToNQuotedList (inStr: string): string;
var x: string;
begin
result:= '';
inStr:= inStr.Trim;
x:= inStr;
if (x.Contains(',')) then
begin
while (x.Contains(',')) do
begin
result:= result + 'N' + LeftStr(x, x.IndexOf(',')).QuotedString + ',';
x:= MidStr(x, x.IndexOf(',')+2, Length(x));
end;
if (x<>'') then
result:= result + 'N' + x.QuotedString;
end
else
result:= 'N' + x.QuotedString;
end;
function IsVal0Or1 (inStr: string): boolean;
begin
result:= (inStr='0') or (inStr='1');
end;
end.