home *** CD-ROM | disk | FTP | other *** search
- (* TBTree13 Copyright (c) 1988 Dean H. Farwell II *)
-
- unit Strings;
-
- (*****************************************************************************)
- (* *)
- (* A D D I T I O N A L S T R I N G R O U T I N E S *)
- (* *)
- (*****************************************************************************)
-
-
- (* Although Turbo has some string handling routines, there are many others
- which would prove useful. Here are but a few. *)
-
- (* Version Information
-
- Version 1.1 - No Changes
-
- Version 1.2 - No Changes
-
- Version 1.3 - No Changes *)
-
-
-
- (*////////////////////////// I N T E R F A C E //////////////////////////////*)
-
-
- interface
-
- (* Takes a string and adds up the integer value of each individual byte.
- This total can be used to randomize the string for Hashing, etc. *)
-
- function TotalString(var str : String) : Word;
-
-
- (* This routine returns the last n characters of a string *)
-
- procedure EndOfString(var str : String;
- n : Byte;
- var resultStr : String);
-
- (*\*)
- (*///////////////////// I M P L E M E N T A T I O N /////////////////////////*)
-
- implementation
-
-
- (* Takes a string and adds up the integer value of each individual byte.
- This total can be used to randomize the string for Hashing, etc. *)
-
- function TotalString(var str : String ) : Word;
-
- var
- tot : Word;
- cnt : Byte;
-
- begin
- tot := 0;
- for cnt := 1 to Length(str) do
- begin
- tot := tot + Integer(str[cnt]);
- end;
- TotalString := tot;
- end; (* end of Total String Function *)
-
-
- (* This routine returns the last n characters of a string *)
-
- procedure EndOfString(var str : String;
- n : Byte;
- var resultStr : String);
-
-
- begin
- resultStr := Copy(str,(Length(str) - n + 1),n);
- end; (* end of EndOfString routine *)
-
-
- end. (* end of Strings unit *)
-