{ 取得硬盘序列号}
function LSGetPhysicalSerialOfCurrentDisk
{$IFDEF MSWINDOWS}(out AHDDInfo: THDDInfo){$ENDIF}: string;
{$IFDEF MSWINDOWS}
function LSGetPhysicalSerialOfCurrentDisk: string;
{$ENDIF}
{从html中删除 Cid
例如.: From <img src="cid:MyImage.png"> To <img src="MyImage.png"> }
function LSRemoveCid(const AHTML: string): string;
{ 删除字符串中的所有HTML代码. }
function LSStripHTMLMarkup(const ASource: string): string;
{ 删除所有换行符 }
function LSDeleteLineBreaks(const AString: string;
const ASubstitute: Char = #32): string;{$IFDEF LSINLINE}inline;{$ENDIF}
下面两个时json与string的互相转换:
{ JSON array to strings. (use array: ["Item1", "Item2",.."ItemN"]) }
procedure LSJSONArrayToStrings(const AJSON: TJSONStringType; AStrings: TStrings);
{ Strings to JSON array. (to array: ["Item1", "Item2",.."ItemN"]) }
function LSStringsToJSONArray(AStrings: TStrings): TJSONStringType;
还有好多
{ Get current path, e.g.: /myproject/, or C:\myproject\. }
function LSCurrentPath: string;
{ Load a file to string. }
function LSLoadFile(const AFileName: TFileName): string;
{ Save a string to file. }
procedure LSSaveFile(const AFileName: TFileName; const AString: string);
{ Execute process and get large output. }
function LSExecProcess(const ACommandLine: string): string;
{ Execute process and get short output. }
function LSExecProcessWithShortOut(const ACommandLine: string): string;
{ Get current user name. }
function LSCurrentUserName: string;
{ Y/N to boolean. }
function LSYNToBool(const S: Char): Boolean;
{ Boolean to Y/N. }
function LSBoolToYN(const B: Boolean): Char;
{$IFDEF UNIX}
{ Get the name of the current Linux distro. }
function LSGetLinuxDistro: string;
{$ENDIF}
{ Get MAC address. (see: http://en.wikipedia.org/wiki/MAC_address) }
function LSGetMACAddress: string;
{ Get process ID by process name. }
function LSGetProcessID(const AProcessName: string;
const AIgnoreCurrent: Boolean = False): Integer;
{ List active process. }
procedure LSListProcess(const AProcess: TStringList;
const AShowPID: Boolean = False; const ASorted: Boolean = True;
const AIgnoreCurrent: Boolean = False);
{ Get if process is running. }
function LSProcessIsRunning(const AProcessName: string;
const AIgnoreCurrent: Boolean = False): Boolean;
{ Kill process by name. }
function LSKillProcess(const AProcessName: string): Boolean;
{ Add a atom string. }
procedure LSGlobalAddAtom(const AAtomName: string);
{ Delete a atom string. }
procedure LSGlobalDeleteAtom(const AAtomName: string);
{ Find a atom string. }
function LSGlobalFindAtom(const AAtomName: string): Boolean;
{ Remove Cid from HTML.
E.g.: From <img src="cid:MyImage.png"> To <img src="MyImage.png"> }
function LSRemoveCid(const AHTML: string): string;
{ Stream to base64 string (see: http://en.wikipedia.org/wiki/Base64) }
function LSStreamToBase64Str(var AStream: TStream): string;
{ Base64 string to stream. }
procedure LSBase64StrToStream(const ABase64Str: string; var AStream: TStream);
{ File to base64 string. }
function LSFileToBase64Str(const AFileName: TFileName): string;
{ Base64 string to file. }
procedure LSBase64StrToFile(const ABase64Str: string;
const AFileName: TFileName);
{ Get physical serial of current disk. }
function LSGetPhysicalSerialOfCurrentDisk
{$IFDEF MSWINDOWS}(out AHDDInfo: THDDInfo){$ENDIF}: string;
{$IFDEF MSWINDOWS}
function LSGetPhysicalSerialOfCurrentDisk: string;
{$ENDIF}
{ Convert string to hex. }
function LSStrToHex(const AStr: string): string;
{ Convert hex to string. }
function LSHexToStr(const AHex: string): string;
{ Generate a UUID as string.
(see: http://en.wikipedia.org/wiki/Universally_unique_identifier) }
function LSUUID: string;
function LSUUID(
const AUseSeparators: Boolean): string;{$IFDEF LSINLINE}inline;{$ENDIF}
{ Delete current executable. }
procedure LSDeleteCurrentExecutable(
{$IFDEF MSWINDOWS}const AAddBATCommands: string = ''{$ENDIF});
{ Change the date time of a file. }
function LSChangeFileDateTime(const AFileName: TFileName;
const AFileDateTime: TDateTime): Boolean;
{ Get the position of the last occurence of a substring in string. }
function LSLastPos(const ASubString, AString: string): Integer;
{ Delete all LineEnding(sLineBreak) from a string. }
function LSDeleteLineBreaks(const AString: string;
const ASubstitute: Char = #32): string;{$IFDEF LSINLINE}inline;{$ENDIF}
{ Replace all char in a string. }
function LSReplaceChar(const AString: string; const AOldChar,
ANewChar: Char): string;{$IFDEF LSINLINE}inline;{$ENDIF}
{ Replace all chars in a string. }
function LSReplaceChar(const AString: string; const AOldChars: TLSChars;
const ANewChar: Char): string;{$IFDEF LSINLINE}inline;{$ENDIF}
{$IFDEF LSGUI}
{ Shorten the pathname with an ellipses "...". }
function LSShortenPathName(const ARect: TRect; ACanvas: TCanvas;
const AFileName: TFileName): TFileName;
function LSShortenPathName(const ARect: TRect; const AFont: TFont;
const AFileName: TFileName): TFileName;{$IFDEF LSINLINE}inline;{$ENDIF}
{ Show a hint on top of a control. }
procedure LSShowHint(const AControl: TWinControl; const AHint: string);
{ Close a hint on top of a control. }
procedure LSCloseHint(const AControl: TWinControl);
{$ENDIF}
{ Return the number of milliseconds since 1970-01-01.
(see: http://www.w3schools.com/jsref/jsref_gettime.asp) }
function LSGetTime: Int64;
{ Remove all HTML code from a string. }
function LSStripHTMLMarkup(const ASource: string): string;
{$IFDEF LSLCL}
{ Get part of a string from a stream. }
function LSGetPartFromStream(const ASkipTo, AEnd: string; var ASource: TStream;
const AIgnoreCase: Boolean = True; const AUpdateSource: Boolean = False): string;
{$ENDIF}
{ Load string to stream. }
procedure LSStrToStream(const AString: string; var AStream: TStream);
{ Load stream to string. }
function LSStreamToStr(const AStream: TStream): string;
{$IFDEF LSGUI}
{ Find item in a ListBox. }
function LSFindItemInListBox(var AListBox: TCustomListBox; const AText: string;
const ACaseSensitive: Boolean = False; const AFindNext: Boolean = True): Integer;
{$ENDIF}
{ JSON array to strings. (use array: ["Item1", "Item2",.."ItemN"]) }
procedure LSJSONArrayToStrings(const AJSON: TJSONStringType; AStrings: TStrings);
{ Strings to JSON array. (to array: ["Item1", "Item2",.."ItemN"]) }
function LSStringsToJSONArray(AStrings: TStrings): TJSONStringType;
{ JSON string to JSON object and to strings. }
procedure LSJSONToJSONObjectStrings(var AJSONObject: TJSONObject;
const AJSON: TJSONStringType; AStrings: TStrings);
{ Round an extended value.
(see: http://www.freepascal.org/docs-html/rtl/math/tfpuroundingmode.html) }
function LSRoundAnExtended(const AValue: Extended;
const ARoundingMode: TFPURoundingMode = rmNearest;
const ARoundingDigits: Integer = -2): Extended;
{ Size to string. }
function LSSizeToString(const ASize: Extended): string;