Check Text
[code lang=”delphi”]procedure CheckText(Sender:TEdit; var Key:Char); begin If not (Key in [‘0′..’9′,’.’,#8, #13]) then Key := #0; If Key = ‘.’ then begin If…
Encrypt & DeCrypt
[code lang=”delphi”]function TForm1.EnDeCode(const Value : String) : String; var CharIndex : Integer; ReturnValue : String; begin ReturnValue := ”; for CharIndex := 1…
Fix Path
// Appends a back slash to a path if needed If Path[length(Path)]‘\’ then Path := Path +’\’; [tags]Delphi, Strings[/tags]
Formatting
Format(‘%-35s’,[MyString]) // Where 35 is the length to make the string // And MyString is the string to format Formatting numbers : [code…
Get Parsed item
[code lang=”delphi”]Function TForm1.GetParsedItem(TheItemStr, ParseStr : String; ItemNum : Integer): String; Var I4 : Integer; S4 : String; Begin TheItemStr := TheItemStr + ParseStr;…
How to use “stringreplace”
>could you tell me how to use “stringreplace” >and if you don’t mind please send me a sample code Are you having a…
Random String
[code lang=”delphi”]Var LoopInt : Integer; DirName, FullName, RanStr : String; FileSavedTo : TextFile; // Length of string to create RandArray : Array[0..4087] Of…
Strip Comments from String
[code lang=”delphi”]type STRIP_STATES = ( SS_NORMA, SS_BRACE, SS_PAREN, SS_LITER ); function SCFS( const S : string; var SS : STRIP_STATES ): string; //…
Tokenizing
Tokenize a string: ExtractString (Classes.pas) [tags]Delphi, Strings[/tags]
How to play system-Sounds?
Q:How to play system-Sounds? A: [code lang=”delphi”]Uses mmsystem ; PlaySound(‘SystemExclamation’,0,SND_ALIAS or SND_ASYNC); PlaySound(‘SystemAsterisk’,0,SND_ALIAS or SND_ASYNC); You can look in the registry to find…