misc.pas

来自「vVC显示图片 VC显示图片 VC显示图片 VC显示图片 VC显示图片」· PAS 代码 · 共 60 行

PAS
60
字号
unit Misc;

interface

uses
  Windows, Classes, SysUtils, Forms, Dialogs, ShlObj,
  Graphics, ActiveX, Controls, StdCtrls, Registry,
  ShellApi;

//------------------------------------------------------------
function BooleanToStr(BoolVal: Boolean): string;
function StrToBoolean(StrVal: string): boolean;
function AddThoundandFlag(Num: integer): string;
function GetIniFileName: string;

//------------------------------------------------------------

implementation


function BooleanToStr(BoolVal: Boolean): string;
begin
  if BoolVal then
    Result := 'True'
  else
    Result := 'False';
end;

function StrToBoolean(StrVal: string): boolean;
begin
  Strval := UpperCase(StrVal);
  if StrVal='TRUE' then
    Result := true
  else
    Result := false;
end;

function AddThoundandFlag(Num: integer): string;
var
  s: string;
  i,j: integer;
begin  
  s := IntToStr(Num);
  Result := '';
  j := 0;
  for i := Length(s) downto 1 do
  begin
    Result := s[i] + Result;
    Inc(j);
    if ((j mod 3)=0) and (i<>1) then Result := ','+Result;
  end;
end;

function GetIniFileName: string;
begin
  Result := ExtractFilePath(Application.ExeName)+'LineCounter.ini';
end;

end.
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?