Foundation 6

Fnd_Text

15 shared methods.

Fnd_Text_Base64ToText

Fnd_Text_Base64ToText (text) --> Text

Converts the Base64 encoded text back to ASCII text.

ParameterTypeDirectionDescription
textToDecodeTextinThe text to decode
ResultTextoutThe decoded text

Fnd_Text_Capitalize

Fnd_Text_Capitalize (text{; style}) --> Text

Modifies the capitalization of the text value. The options paramter determines how the text will be modified. If no second parameter is passed, Book Title capitalization is applied.

ParameterTypeDirectionDescription
theTextTextinThe text to format
optionsLongintinStyle (optional)
ResultTextoutThe formatted text

Fnd_Text_CapitalizeExclude

Fnd_Text_CapitalizeExclude (->exclude array)

Use this method to specify or determine the words that will not be capitalized using the Fnd_Text_Capitalize method.

To get a list of words that will be excluded from capitalization, pass an empty text array.

To set the words to exclude from the capitalization routine, pass an array with at least one element.

To clear the list of words to exclude from the capitalization routines, pass an array with one element consisting of a blank string.

ParameterTypeDirectionDescription
excludeWordsArrayPointerinText array of words to exclude

Fnd_Text_DecodeBase64Blob

Fnd_Text_DecodeBase64Blob (->blob)

Converts the blob from Base64 back to the bytes it encodes.

Whitespace inside the encoded text is ignored, so text produced by Fnd_Text_EncodeBase64Blob decodes whatever line breaks it was wrapped with.

ParameterTypeDirectionDescription
pPassedBlobPointerinA pointer to a blob

Fnd_Text_EncodeBase64Blob

Fnd_Text_EncodeBase64Blob (->blob{; line breaks?{; line break character(s)}})

Converts the blob to Base64, in place.

Line breaks are inserted after every 76 characters unless the second parameter says otherwise.

ParameterTypeDirectionDescription
pPassedBlobPointerinA pointer to the blob to encode
inBInsertLineBrBooleaninInsert line breaks every 76 characters (optional, default True)
inEOLTextinThe line break characters (optional, default a carriage return)

Fnd_Text_EqualStrings

Fnd_Text_EqualStrings (String1; String2) --> Boolean

Compares two strings in the most efficient manner

ParameterTypeDirectionDescription
stringOneTextinString1
stringTwoTextinString2
ResultBooleanoutTrue if the strings are identical

Fnd_Text_FormatNumber

Fnd_Text_FormatNumber (string, format) --> Text

Formats a numeric string (like a zip code or phone number). Removes any dashes, "E"s, periods, etc. before formatting.

ParameterTypeDirectionDescription
theNumberToFormatTextinThe number as text
theFormatToUseTextinThe format to use
ResultTextoutThe formatted number

Fnd_Text_Info

Fnd_Text_Info (label) --> Text

Returns requested information. See the Fnd_Gen_ComponentInfo method for more information.

ParameterTypeDirectionDescription
requestTextinInfo desired ("version" or "name")
ResultTextoutResponse

Fnd_Text_MD5Encoding

Fnd_Text_MD5Encoding ({charset}) --> Text

Sets the charset Fnd_Text_TextToMD5 converts text through before hashing it, for every subsequent call that does not name one itself.

Returns the charset currently in force.

The default is "ISO-8859-1". Call this once at startup to change it:

Fnd_Text_MD5Encoding("UTF-8")

ASCII hashes the same under either, so this only affects text carrying characters above 127. Changing it invalidates any stored digest of such text.

The setting is shared, so it applies to every process in the host.

ParameterTypeDirectionDescription
inCharsetTextinThe charset name, as CONVERT FROM TEXT understands it (optional)
ResultTextoutThe charset now in force

Fnd_Text_PadSpaces

Fnd_Text_PadSpaces (text; length)

Pads the passed text with spaces. If the length of the text is greater than the length paramter, it will be truncated.

ParameterTypeDirectionDescription
inTextTextinThe text to pad
lengthLongintinThe desired length
ResultTextoutThe modified text

Fnd_Text_StripSpaces

Fnd_Text_StripSpaces (text{; options{; altSpaces}}) --> Text

Strips spaces from the text that is passed to it.

If no second parameter is passed, leading and trailing spaces are stripped from the text.

Add these values together to specify which spaces to strip: 1 + 2 = 3 to strip leading and trailing spaces 1 + 4 = 5 to strip leading and double spaces etc.

A third optional parameter allows you to specify alternatives or multiples: " " - normal behaviour char(9) - strip tabs " "+char(9) - strip spaces and tabs " "+char(9)+char(160) - and non-breaking spaces Leading and trailing runs may mix the characters in any order.

Matching is strict, so a character is stripped only if it is listed..

ParameterTypeDirectionDescription
inTheTextTextinThe text from which to strip spaces
inOptionsLongintinOptions (optional)
inAltSpacesTextinAlternatives to spaces (optional)
ResultTextoutThe text with spaces stripped

Fnd_Text_TextToBase64

Fnd_Text_TextToBase64 (text) --> Text

Converts the text to Base64.

ParameterTypeDirectionDescription
textToEncodeTextinThe text to encode
ResultTextoutThe encoded text

Fnd_Text_TextToMD5

Fnd_Text_TextToMD5 (text{; charset}) --> Text

Generates and returns a MD5 message digest based on the text.

The default charset is ISO-8859-1. Pass a charset name to hash through a different one, or call Fnd_Text_MD5Encoding once to change the default for every subsequent call.

Fnd_Text_TextToMD5("abc")             -->  900150983cd24fb0d6963f7d28e17f72
Fnd_Text_TextToMD5($text; "UTF-8")    -->  hashed as UTF-8 instead
Fnd_Text_MD5Encoding("UTF-8")         -->  every later call uses UTF-8
ParameterTypeDirectionDescription
textToMD5DigestTextinThe text from which to create the message digest
inCharsetTextinCharset to convert the text through (optional)
ResultTextoutThe message digest

Fnd_Text_Trim

Fnd_Text_Trim (text) --> Text

Strips native Trim whitespace from both ends of text: space, tab, LF, CR, vertical tab and form feed. Non-breaking space is deliberately excluded.

ParameterTypeDirectionDescription
inTheTextTextinThe text to trim
ResultTextoutThe trimmed text

Fnd_Text_Wrap

Fnd_Text_Wrap (text; max line length) --> Text

Wraps the text into lines of at most the given length, joined by carriage returns. The length is a character count, not a pixel width.

Lines break at the last space that fits. A run with no space in it breaks hard at the limit, and a carriage return already in the text ends its line where it stands.

ParameterTypeDirectionDescription
inRemainingTextTextinThe text to wrap
lineLengthLongintinMax line length of wrapped text
ResultTextoutThe wrapped text Routine by Marco Bernasconi <mbernasconi@befund.com>