This are some useful string functions that I often use in my programs. It contains following functions: Function StrPaste (SourceString:string; SearchString:string; ReplaceString:string): string; { paste part of a string with another string } Function StrDel (SourceString:string; DeleteString:string): string; { delete part of a string } Function FirstUp (SourceString:string): string; { capitalize first letter of each word } Function RightExpand (SourceString:string; FillChar:string; Count:integer):string; { fill a string with a char up to length } Function LeftExpand (SourceString:string; FillChar:string; Count:integer):string; { fill a string from the front with a char up to length } Function MidExpand (SourceString:string; FillChar:string; Count:integer):string; { cover a string with char up to length } Function CutRight (SourceString:string; Count:integer):string; { shorten a string to length } Function CutLeft (SourceString:string; Count:integer):string; { shorten a string to length from the beginning } Function CutMid (SourceString:string; Count:integer):string; { cut middle of a string to length } Function HideMid (SourceString:string; Count:integer):string; { hide middle of a string with '...' until length } Function CountInstring (SourceString:string; SearchString:string):integer; { count how many times a string contains a special string } Function Match (SourceString:string; SearchString:string):boolean; { check if two strings are identical (with Joker: *str*, *str, str*, str*str, *, str) } Function SecsToTimeStr (seconds:integer) : string; { converts seconds to hh:mm:ss } Function TimeStrToSecs (TimeString:string) : integer; { converts hh:mm:ss to seconds } Function HexToInt (HexString:string) : integer; { converts a hex-string to integer } Function IntToBin (Value:LongInt; Size:Integer): string; { converts an integer to binary-string with a special size } Function BinToInt (Value:String): LongInt; { converts binary string to integer } Function DecToBinStr (Number: integer): string; { converts an integer to a binary-string } Function GetValue (Source: string): integer; { extracts an integer from a string } Function FromToString (StartValue: integer; EndValue: integer; Addition: string): string; { Converts 2 values with additional text to a string } Function FromPlusString(StartValue: integer; CountValue: integer; Addition: string): string; { Converts a value to value plus count with additional text to a string } Function LeadingZeros (Value:Integer; Count:integer):string; { fill a numeric string from the front with '0' up to length } Function NextPos (SourceString: string; SearchString: string; LastPos: integer): integer; { finds next position of the searchstring in the sourcestring } Function Max (Value1: integer; Value2: integer): integer; { returns maximum of 2 values } Function Min (Value1: integer; Value2: integer): integer; { returns minimum of 2 values } Function CheckRange (Value, Min, Max: integer): integer; { returns nearest value between a range } Function SimpleString (SourceString: string): string; { returns a simplified string, useful when you don't know the correct spelling (a.e. ieh->i) } Function MakeString (asc: char; Count: integer): string; { returns a string of same asc with a length of count } Function TabToSpace (SourceString: string; Count: integer): string; { converts tabs to count of spaces } Function SpaceToTab (SourceString: string; Count: integer): string; { converts count of spaces to tabs } Function ShortenDir (SourceString: string): string; { shortens a directory string to drive:\...\final folder\(file) }
File List:
@PSC_ReadMe_327_7.txt
4Kb
JDStrings.pas
16Kb
JDStrings.txt
4Kb
Similar code
The art of Delphi - Date to Word
(Popularity: ) : Convert Dates to 16 bit(Word) variables THash
(Popularity: ) : THash works like Perl's associative array, i.e., an array indexed by a Key of type string with an associated Value of type Pointer, which means Value is anything that will fit into a Pointer type -- you just need to ... TableCopyV2
(Popularity: ) : TableCopyv2.. so smart..nice to use..helpful. Have you ever copied Field names from a table "Fields Editor" to use it with 'FieldByName' command to put a data or edit a field value. This smart program tranforms copied text from a "Field ... Lite Registry 1.1
(Popularity: ) : Lite Registry 1.1 unit brings the power of the TRegistry class to your application by adding only 3 KBs to your EXEcutable files instead of 120 KB while using the TRegistry Class ! You can Read/Write DWORD or String, Delete ... TLanguageChanger
(Popularity: ) : This is a delphi component for handeling Windows Virtual Keyboard layouts. You can retrive list of existed layouts, change them and retrive information about each layout. Stringsplit Procedure
(Popularity: ) : It works as the Visual Basic Split function
Please Rate me . IntToStr and StrToInt
(Popularity: ) : Using this unit, you can convert String or a PChar to an unsigned DWORD or a signed Integer. The purpose of the code is to demonstrate the conversion's steps. The code has explanation and comments. TableCopy
(Popularity: ) : So smart..nice to use..helpful.. Have you ever copied Field names from a table "Fields Editor" to use it with 'FieldByName' command to put a data or edit a field value. This smart program tranforms copied text from a "Field Editor" ... ShellNotifyIcon
(Popularity: ) : This component allows you to add animated icons to the Windows system tray. Use Popup Menu’s without writing a single line of code. Support for the following Mouse Events: OnDblClick, OnMouseDown and OnMouseUp.