<-- Previous || Up || Next -->

Translate String Using Table Function
String Replacements Class

Public Function TranslateStringUsingTable( _
      ByVal vLine As Variant _
    , ByVal vTable As Variant _
    ) As Variant

Translate characters in vLine.
Like the TranslateString function except that this function requires a string containing the translation for every character between Chr$(0) and Chr$(255).

Example:
    Assuming
       Dim TransTable As String
       TransTable = Space$(64) + "acbdefghijklmnopqrstuvwxyz"
    for example
       TranslateStringUsingTable("ABCDEFabcdef", TransTable) = "abcdefabcdef"
See also:
    TranslateString Function
    TranslateStringUsingCharacterPairs Function
vLine: The string in which characters are to be translated. Function returns Null if vLine is Null or cannot be fixed up to a String (Behavior #1).

vTable: The string containing the replacement/translation for each character. Each character within vTable is the replacement for the character whose ASCII value is its position within vTable - 1. For example, the first character within vTable is the translation for the character with ASCII value 0 (Chr$(0)), the second character within vTable is the translation for the character with ASCII value 1 (Chr$(2)), etc. Function returns Null if vTable is Null or cannot be fixed up to a String (Behavior #2).

If the string vTable does not contain a translation for a character, then the character will remain un-translated (Behavior #3).

Note: Function performs Binary comparisons (to determine if characters match) by virtue of the algorithm used (Behavior #4).

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.