home *** CD-ROM | disk | FTP | other *** search
- !SHORT:ExtractWords Extract a specified number of worrds from string
- ExtractWords StrngTTT
-
-
-
- Purpose To extract a number specified number of words from a string.
-
- Returns string;
-
- Declaration ExtractWords(S,N: byte; Str: string):string;
-
- S is number of the first word to extract
- N is the number of words to extract
- Str is the string to extract from
-
- Uses StrngTTT.
-
- Remarks If there are insufficient words to extract, the function
- will return as many words as possible.
-
- If there are fewer than S words in the string, the function
- returns a null string, i.e. ''.
-
- Example
-
-
- USES STRNGTTT;
- VAR LASTBIT : STRING;
- BEGIN
- LASTBIT := EXTRACTWORDS(4,3,'WHO THE HELL SAYS
- CENSORSHIP IS GOOD!');
- END.
-
-
- The string LastBit is assigned the value 'Censorship is good!'.
-
-
-
-
-
-
-
- !SHORT:First Return first part of string
- First StrngTTT
-
-
-
- Purpose To return the first part of a string.
-
- Returns string;
-
- Declaration First(N: byte; Str: string):string;
-
- N is the number of characters to extract.
- Str is the string to extract them from
-
- Uses StrngTTT.
-
-
-
- Remarks If the source string is fewer than N characters long, the
- whole string is returned.
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := FIRST(25,'ALL GOOD THINGS WILL COME TO PASS!');
- END.
-
-
- The string TTT is assigned the value "All good things will come".
-
- !SEEALSO:Last
-
-
- !SHORT:Int_to_Str Convert integer to string
- Int_to_Str StrngTTT
-
-
-
- Purpose To convert an integer to a string.
-
- Returns string;
-
- Declaration Int_to_Str(Number: longInt):string;
-
- Number can actually be byte, integer or longint
-
- Uses StrngTTT.
-
-
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := INT_TO_STR(130);
- END.
-
-
- The value of TTT is set to '130'.
-
- !SEEALSO:Real_to_Str Str_to_Int
-
-
- !SHORT:Last Return last part of string
- Last StrngTTT
-
-
-
- Purpose To return the last part of a string.
-
- Returns string
-
- Declaration Last(N: byte; Str: string):string;
-
- N is the number of characters to extract.
- Str is the string to extract them from
-
- Uses StrngTTT.
-
-
-
- Remarks If the source string is fewer than N characters long, the
- whole string is returned.
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := LAST(11,'NEVER TAKE DRUGS!');
- END.
-
-
- The string TTT is assigned the value "Take Drugs!".
-
- !SEEALSO:First
-
- !SHORT:LastPos Find last occurence of character in string
- LastPos StrngTTT
-
-
-
- Purpose To find the last occurence of a character in a string.
-
- Returns byte;
-
- Declaration LastPos(C:char; Str:string):byte;
-
- C is the character to search for.
- Str is the string to search
-
- Uses StrngTTT.
-
-
- Remarks If the character is not found in the string, the function
- returns 0.
-
- The search is case sensitive.
-
- Also note "pos" Turbo internal Function
- Example
-
-
- USES STRNGTTT;
- VAR B : BYTE;
- BEGIN
- B := LASTPOS('J','TECHNOJOCK SOFTWARE!');
- END.
-
-
- The variable B is assigned the value 12
-
-
-
-
- !SHORT:Lower Convert string to lower case
- Lower StrngTTT
-
-
-
- Purpose To convert a string to lower case letters.
-
- Returns String;
-
- Declaration Lower(Str:string):string;
-
- Str is the string to be converted
-
- Uses StrngTTT.
-
-
-
- Remarks Only the upper case alphabet (A..Z) is affected.
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := LOWER('LEARNING TO TYPE');
- END.
-
-
- The string TTT is assigned the value "learning to type".
-
- !SEEALSO:Upper Proper
-
-
- !SHORT:OverType Combine two overlapping strings
- OverType StrngTTT
-
-
-
- Purpose To combine two overlapping strings.
-
- Returns string;
-
- Declaration OverType(N:byte; StrS,StrT:string):string;
-
- N is the character position that the StrT (target) will be
- overlayed on the StrS (source).
-
- Uses StrngTTT.
-
- Remarks If N is actually larger than the length of the source
- string, the source string is extended with spaces ' ' i.e.
- no problem.
-
- Any characters after the Nth position in StrS will be
- replaced by the characters in StrT.
-
- If N + length(StrT) is less than the original length of StrS
- then the last part of StrS will remain intact. (Phew!)
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := OVERTYPE(5, 'BOB AINSBURY', 'TECHNOJOCK'));
- END.
-
-
- The string TTT is assigned the value "Bob TechnoJock".
-
-
-
-
-
-
- !SHORT:PadCenter Expand and center string with a specific character
- PadCenter StrngTTT
-
-
-
- Purpose Tp expand and center a string with a specific character.
-
- Returns String;
-
- Declaration PadCenter(Str:string; Size:byte; Pad:char):string;
-
- Str is the string to be expanded
- Size is the new string length
- Pad is the character to expand the string with
-
- Uses StrngTTT.
-
-
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := PADCENTER(' ASTERISKS ',20,'*');
- END.
-
-
- The string TTT is assigned the value "***** Asterisk *****".
-
- !SEEALSO:PadLeft PadRight
-
-
- !SHORT:PadLeft Expand & left justify string with specific character
- PadLeft StrngTTT
-
-
-
- Purpose To expand and left justify a string with a specific
- character.
-
- Returns String;
-
- Declaration PadLeft(Str:string; Size:byte; Pad:char):string;
-
- Str is the string to be expanded
- Size is the new string length
- Pad is the character to expand the string with
-
- Uses StrngTTT.
-
-
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := PADLEFT(' ASTERISKS ',20,'*');
- END.
-
-
- The string TTT is assigned the value " Asterisk **********".
-
- !SEEALSO:PadCenter PadRight
-
-
- !SHORT:PadRight Expand & right justify string with specific character
- PadRight StrngTTT
-
-
-
- Purpose To expand and right justify a string with a specific
- character.
-
- Returns String;
-
- Declaration PadRight(Str:string; Size:byte; Pad:char):string;
-
- Str is the string to be expanded
- Size is the new string length
- Pad is the character to expand the string with
-
- Uses StrngTTT.
-
-
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := PADRIGHT(' ASTERISKS ',20,'*');
- END.
-
-
- The string TTT is assigned the value "********** Asterisk ".
-
- !SEEALSO:PadCenter PadLeft
-
-
- !SHORT:PosWord Determine starting character position of word
- PosWord StrngTTT
-
-
-
- Purpose To determine the starting character position of a word.
-
- Returns byte;
-
- Declaration PosWord(WordNo:byte; Str:string):byte;
-
- WordNo is the number of the word to check
- Str is the string to be analyzed
-
- Uses StrngTTT.
-
-
-
- Remarks The function returns zero if the string is a null or if
- there are less than WordNo words in the string.
-
- Example
-
-
- USES STRNGTTT;
- VAR B : BYTE;
- BEGIN
- B := POSWORD(3,'THE QUICK BROWN LINEMAN');
- END.
-
-
- The variable B is assigned the value 11.
-
- !SEEALSO:WordCnt ExtractWords
-
-
- !SHORT:Proper Convert a string so each word begins with uppercase
- Proper StrngTTT
-
-
-
- Purpose To convert a string so that each word begins with an
- uppercase letter.
-
- Returns String;
-
- Declaration Proper(Str:string): string;
-
- Str is the string to be converted
-
- Uses StrngTTT.
-
-
-
- Remarks Only the alphabet (a..z) is affected.
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := PROPER('R D AINSBURY');
- END.
-
-
- The string TTT is assigned the value "R D Ainsbury".
-
- !SEEALSO:Lower Upper
-
-
- !SHORT:Real_to_Str Convert real to string with specified decimal places
- Real_to_Str StrngTTT
-
-
-
- Purpose To convert a real number to a string with a specified number
- of decimal places.
-
- Returns string;
-
- Declaration Real_to_Str(R:real; Dec:byte):string;
-
- R is the real number
- Dec is the number of decimal places for the string
-
- Uses StrngTTT.
-
-
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := REAL_TO_STR(12345.789990,2);
- END.
-
-
- The string TTT is assigned the value "12345.79".
-
- !SEEALSO:Str_to_Real Int_to_Str
-
-
- !SHORT:Strip Remove character from string
- Strip StrngTTT
-
-
-
- Purpose To remove a character from a string
-
- Returns string;
-
- Declaration Strip(L,C:char; Str:string):string;
-
- L is a character indicating which part of the string to
- strip the characters (see remarks)
- C is the character to strip
- Str is the string to strip
-
- Uses StrngTTT.
-
- Remarks The valid values of L are
- 'L' strip all leading characters
- 'R' strip all trailing characters
- 'B' strip leading and trailing characters
- 'A' strip all occurences of the character
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := STRIP('B',' ',' THIS IS NEAT ');
- END.
-
-
- The string TTT is assigned the value "This is neat".
-
-
-
-
-
- !SHORT:Str_to_Int Convert string to integer
- Str_to_Int StrngTTT
-
-
-
- Purpose To convert a string to an integer
-
- Returns integer;
-
- Declaration Str_to_Int(Str:string): integer;
-
- Str is the string to be converted
-
- Uses StrngTTT.
-
- Remarks If the string Str is null or the string cannot be
- successfully converted to an integer, the function returns a
- zero.
-
-
-
-
-
- Example
-
-
- USES STRNGTTT;
- VAR I : INTEGER;
- BEGIN
- I := STR_TO_INT('165');
- END.
-
-
- The variable I is assigned the value 165.
-
- !SEEALSO:Str_to_Real Int_to_Str
-
-
- !SHORT:Str_to_Real Convert string to real
- Str_to_Real StrngTTT
-
-
-
- Purpose To convert a string to an real.
-
- Returns real;
-
- Declaration Str_to_real(Str:string):real;
-
- Str is the string to be converted
-
- Uses StrngTTT.
-
- Remarks If the string Str is null, or the string cannot be
- successfully converted to a real , the function returns a
- zero.
-
- This procedure gets around the bug in Turbo 4 that occurs
- when trying to convert a string starting with a '.', to a
- number.
-
-
-
- Example
-
-
- USES STRNGTTT;
- VAR R : INTEGER;
- BEGIN
- R := STR_TO_REAL('165.787');
- END.
-
-
- The variable R is assigned the value 165.787 .
-
- !SEEALSO:Str_to_Int Real_to_Str
-
-
- !SHORT:Upper Convert string to upper case
- Upper StrngTTT
-
-
-
- Purpose To convert a string to upper case letters.
-
- Returns String;
-
- Declaration Upper(Str:string):string;
-
- Str is the string to be converted
-
- Uses StrngTTT.
-
-
-
- Remarks Only the alphabet (a..z) is affected.
-
- Example
-
-
- USES STRNGTTT;
- VAR TTT : STRING;
- BEGIN
- TTT := UPPER('SMALL LETTERS');
- END.
-
-
- The string TTT is assigned the value "SMALL LETTERS".
-
- !SEEALSO:Lower Proper
-
-
- !SHORT:WordCnt Count number of words in string
- WordCnt StrnTTT
-
-
-
- Purpose To count the number of words in a string.
-
- Returns byte;
-
- Declaration WordCnt(Str:string):byte;
-
- Str is the string to be counted
-
- Uses StrngTTT.
-
-
-
- Example
-
-
- USES STRNGTTT;
- VAR B : BYTE;
- BEGIN
- B := WORDCNT('THATS ALL THE STRING FUNCTIONS, FOLKS!');
- END.
-
-
- The variable B is assigned the value 6.
-
- !SEEALSO:ExtractWords PosWord
-