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

Translate String Using Character Pairs Function
String Replacements Class

Public Function TranslateStringUsingCharacterPairs( _
      ByVal vLine As Variant _
    , ByVal vFromToChars As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Translate characters in vLine.
Characters in vLine also appearing in odd-numbered positions in string vFromToChars are replaced with the following character from vFromToChars.

Like the TranslateString function, except that this one requires one string with pairs of find-and-replace characters.
Example:
    TranslateStringUsingCharacterPairs("This is a test.", "sXiYeZ") = "ThYX YX a tZst"
See also:
    TranslateString Function
    TranslateStringUsingTable 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).

vFromToChars: The string containing pairs of characters that each describe how to translate one character into another. For example, a vFromToChars of "sXiY" tells this function to translate all "s" characters into "X" and to translate all "i" characters into "Y" Function returns Null if vFromToChars is Null or cannot be fixed up to a String (Behavior #2).

vCompare: Specifies the type of comparison used to determine if characters match (Behavior #3). vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number (Behavior #4).

Function uses the TranslateString function to actually perform the translation.

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