1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-11 20:05:03 -05:00
Simba/Units/MMLAddon/PSInc/Wrappers/strings.inc

1 line
2.4 KiB
PHP

function ps_Format(const fmt : string;const args : array of const) : string; extdecl;
begin;
Result := Format(fmt,Args);
end;
function ps_Capitalize(str : string) : string;extdecl;
begin
result := Capitalize(str);
end;
function ps_ExtractFromStr( Str : string; Extract : StrExtr) : string; extdecl;
begin
result := extractfromstr(str,extract);
end;
function ps_BoolToStr(bool : boolean) : string; extdecl;
begin;
result := BoolToStr(bool,true);
end;
function ps_Replace(Text, FindStr, ReplaceStr: string; Flags: TReplaceFlags): string; extdecl;
begin;
result := StringReplace(Text,FindStr,ReplaceStr,Flags);
end;
function ps_IntToStr(int : integer) : string; extdecl;
begin
result := inttostr(int);
end;
function ps_FloatToStr(flt : extended) : string; extdecl;
begin
result := floattostr(flt);
end;
function ps_StrToInt(value: String): Integer; extdecl;
begin
result := StrToInt(value);
end;
function ps_StrToIntDef(value: String; default: Integer): Integer; extdecl;
begin
result := StrToIntDef(value,default);
end;
function ps_StrToFloat(value: String): Extended; extdecl;
begin
result := StrToFloat(value);
end;
function ps_StrToFloatDef(value: String; default: Extended): Extended; extdecl;
begin
result := StrToFloatDef(value,default);
end;
function ps_StrToBool(value: String): Boolean;extdecl;
begin
result := StrToBool(value);
end;
function ps_StrToBoolDef(value: String; default: Boolean): Boolean; extdecl;
begin
result := StrToBoolDef(value,default);
end;
function ps_Between(s1, s2, str: string): string; extdecl;
var
I,J : integer;
begin;
Result := '';
I := pos(s1,str);
if I > 0 then
begin;
i := i + length(s1);
j := posex(s2,str,i);
if j > 0 then
Result := copy(str,i,j-i);
end;
end;
function ps_Implode(Glue : string; Pieces: TStringArray): string;extdecl;
begin
result := implode(glue,pieces);
end;
function ps_Explode(del, str: string): TStringArray;extdecl;
begin
result := Explode(del,str);
end;
procedure ps_ExplodeWrap(del, str: string; var res : TStringArray);extdecl;
begin
res := Explode(del,str);
end;
function ps_Padl(s: String; i: longInt): String;extdecl;
begin
result := StringOfChar(Char(' '), i - length(s)) + s;
end;
function ps_Padz(s: String; i: longInt): String;extdecl;
begin
result := StringOfChar(Char('0'), i - length(s)) + s;
end;
function ps_Padr(s: String; i: longInt): String;extdecl;
begin
result := s + StringOfChar(Char(' '), i - Length(s));
end;