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

Average Length Any Part Function
String Searches Class

Public Function AverageLengthAnyPart( _
      ByVal vValue As Variant _
    , Optional ByVal vPartSeparator As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Return the average length of any part of a string.
Does not include the length of the string which separates the parts in the average.
The "parts" of the string are the sub-strings between occurrences of the string vPartSeparator.

Examples:
    AverageLengthAnyPart("This is a test." , " ") = 2.75
    AverageLengthAnyPart("This is a test." + vbCrLf + "Hello world.", vbCrLf) = 13.5
    AverageLengthAnyPart("This is a test." + vbCrLf + "Hello world.", Null) = 29
See also:
    CountStrings Function
vValue: The string containing the "parts" whose lengths are to be averaged. Function returns Null if vValue is Null or cannot be fixed up to a String.

vPartSeparator: The string which separates the parts of vValue. Function returns the length of vString if vPartSeparator is missing or Null or cannot be fixed up to a String.

Use a space character as the separator to calculate the average length of words within the string (assuming that each word is separated by a single space).
Use carriage return and line feed as the separator to calculate the average length of lines within the string (assuming that each line is separated by carriage return and new line characters).

vCompare: Specifies the type of comparison used to find separator strings within the string vValue. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

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