Important alert: (current site time 7/16/2013 5:09:07 AM EDT)
 

winzip icon

JDStrings

Email
Submitted on: 5/1/2001 11:34:08 AM
By: Dommi 
Level: Intermediate
User Rating: By 2 Users
Compatibility: Delphi 5
Views: 11485
 
     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) }
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
10/8/2004 6:09:18 AM

dgfd
(If this comment was disrespectful, please report it.)

 
5/27/2007 11:15:19 PM

may i get source code data encryption standard in delphi please?
just sent to my email..
thanks...
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.