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

Translate String Function
String Replacements Class

Public Function TranslateString( _
      ByVal vLine As Variant _
    , ByVal vFrom As Variant _
    , ByVal vTo As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Translate characters in vLine. Characters in vLine also appearing in vFrom are replaced with the corresponding character from vTo.

Examples:
    TranslateString("This is a test.", "sie", "XYZ") = "ThYX YX a tZst"
    TranslateString("This is a test.", "sie ", "XYZ") = "ThYX YX a tZst" ' Behavior #6
See also:
    ReplaceCharacter Function
    TranslateStringUsingCharacterPairs Function
    TranslateStringUsingTable Function
    ROT13 Function
    TelephoneNumberLettersToDigits 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).

vFrom: The string containing the characters which are to be replaced by a corresponding character from vTo wherever they appear within string vLine. Function returns Null if vFrom is Null or cannot be fixed up to a String (Behavior #2).

vTo: The string containing the characters which are to replace corresponding characters from vFrom wherever one of those characters from vFrom appears within string vLine. Function returns Null if vTo is Null or cannot be fixed up to a String (Behavior #3).

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

Note: Function only examines the characters in string vFrom and vTo up to the length of the shorter string.

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