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

Average Strings Function
String Numerics Class

Public Function AverageStrings( _
      ByVal vStringOne As Variant _
    , ByVal vStringTwo As Variant _
    , Optional ByVal vTruncate As Variant _
    ) As Variant

Return the average (mean) value of two strings.

Examples:
    AverageStrings("AB", "EF") = "CD"
    AverageStrings("AB", "FG") = "C" + Chr$(196) + Chr$(128)
    AverageStrings("AB", "FGH") = "C" + Chr$(196) + Chr$(164)
See also:
    AddStringCharacters Function
    AverageStringsSample Subroutine
    AverageStringsTest Subroutine
vStringOne: First of two strings which are to be interpreted as numeric bit strings so that they can be averaged. Function returns Null if vStringOne is Null or cannot be fixed up to a String.

vStringTwo: Second of two strings which are to be interpreted as numeric bit strings so that they can be averaged. Function returns Null if vStringTwo is Null or cannot be fixed up to a String.

vTruncate: Determine what to do if the average value cannot be represented by a string whose length is the same as the maximum length of the two strings vStringOne and vStringTwo. If True, this condition will result in the addition of another character with ASCII value 128 (Chr$(128)) onto the end of the result string. If False, this condition will be ignored. vTruncate defaults to False (this condition results in Chr$(128) being added onto end of the result) if it is missing or Null or cannot be fixed up to a number.

Note: This function assumes that the first string character represents the most-significant-byte within the string (this is the usual interpretation of string values).

Function returns an empty string if both vStringOne and vStringTwo are empty strings.

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