===============================================================
Save this library as "text_lib.mv" in your Miva HTML directory.
===============================================================
This library is a set of nine text tools... some new tools and
some that have been around since htmlscript days... but all
with my own twist :) None use macros.
Its mainly a re-invention reducer for Miva neophytes because
most oldtimers have already written their own versions.
Brian R. Bullock
brian@wwwebweaver.com
http://wwwebweaver.com/func_junc/
Released to the Public Domain on July 12, 2001
===============================================================
_________________________
______Sentence_Case______
This function changes the case of all sentences (A block of
words ending with a period) in a text string to match typical
sentence structure (first character of first word is capitalized,
other characters are lower case).
Great for fixing text entered by people who insist on writing in
all upper or lower case. Note: it can't properly capitalize names
in sentences although it does correctly capitalize the word "I".
PARAMETERS
pText = the text to process.
SAMPLE CODE
______________________
______Title_Case______
This function changes the case of all words in a string to match
typical title structure (first character of every word is capitalized,
other characters are lower case). Great for fixing names entered by
people who insist on writing in all upper or lower case.
PARAMETERS
pText = the text to process.
SAMPLE CODE
______________________
______Check_Case______
This function checks a string to see if all the alphabetic characters
are upper or lower case. Unlike isupper() and islower() this function
ignores non-alphabetic characters when it parses the string. That allows
you to check strings that may contain special characters (ie: comma,
period, slash, etc). Especially useful in conjunction with Title_Case()
and Sentence_Case().
This function:
Returns a null if even one of the alphabetic characters is of different
case than the others.
Returns the string "upper" (no quotes) if all alphabetic characters are
upper case.
Returns the string "lower" (no quotes) if all alphabetic characters are
lower case.
PARAMETERS
pText = the text to process.
SAMPLE CODE
_____________________
______Word_Wrap______
This function wraps lines of text at the nearest whole word less than
or equal to a maximum line length that you specify. It can wrap using
either
for web applications or ascii carriage return/line feeds for
email applications.
PARAMETERS
pText = the text to wrap.
pLen = the maximum number of characters in a line.
pType = the string 'web' for HTML breaks, anything else for Ascii breaks.
SAMPLE CODE
_______________________
______Highlight______
This function highlights every occurence of a keyword or phrase in a
text string. It surrounds the keyword or phrase with the html start/end
tag pair that you specify. It is case-insensitive so it will find "DOG"
using "dog". You can also tell it to find only whole words and ignore
substrings within words.
PARAMETERS
pText = the text to process.
pKeyword = The word or phrase to highlight.
pType = The type of highlighting.
Sample acceptable types (case insensitive):
b = bold
i = italic
u = underline
tt = teletype
sub = subscript
sup = superscript
strike = strikethrough
pType is used to build HTML start and end tags so you may use
the text string from any HTML tags that do not have attributes
and where the only difference between the start and end tag is
the / character.
pWholeWords = Input 1 to highlight only whole words. Input 0 to
highlight all occurences including substrings.
SAMPLE CODE
______________________
______Word_Count______
This function counts the number of words in a text string. Hyphenated
words are counted as one word.
PARAMETERS
pText = the text to process.
SAMPLE CODE
___________________________________
______Convert_Email_Hex_Codes______
When MvPOP reads an email containing HTML, the messagebody variable may
contain hex encoded special characters. This function turns those encoded
characters back into ascii characters.
PARAMETERS
pText = the text to process.
SAMPLE CODE
__________________
______Censor______
This function parses a text string for prohibited words and phrases. It
returns a null if the text string is clean and "1" if the string contains
prohibited words or phrases. The list of prohibited words or phrases is
contained in a .dat file that you create. Each word or phrase must be on
its own line and the last line in the file must be blank. The first and
last character of the word or phrase MUST NOT be a space. This function
is case-insensitive. Hyphens are changed to spaces for parsing so use spaces
between the words in a phrase, instead of hyphens, in your .dat file.
PARAMETERS
pText = the text to process.
pWordListName = the path/name of the .dat file containing the list of
prohibited word and phrases.
SAMPLE CODE
_________________________
______Dollar_Format______
This function changes numbers to US Dollar format. It correctly handles
negative numbers and fractional numbers.
PARAMETERS
pNumber = the number to format.
SAMPLE CODE
===============================================================