Function Character Arrays Class

StripRangeOfCharacters

Returns the string vValue except for the characters whose ASCII values fall within a specific range.

Signature (Visual Basic / VBA)

Public Function StripRangeOfCharacters( _
      ByVal vValue As Variant _
    , ByVal vFromAsc As Variant _
    , ByVal vThruAsc As Variant _
    ) As Variant

Code Example

    StripRangeOfCharacters("123 ABC 123", 0, 64) = "ABC"
    StripRangeOfCharacters("123 ABC 123", Chr$(0), "@") = "ABC"

Parameters

Parameter Description
vValue String containing the characters which will be copied to the result string unless their ASCII value is within the specified range. Function returns Null if vValue is Null or cannot be fixed up to a String.
vFromAsc String character or numeric ASCII value describing the lower bound of the range of characters to be removed from string vValue. Note: Special argument fix-up code. If vFromAsc is an empty string, then vValue is returned unchanged. If vFromAsc is a non-empty string, then the ASCII value of its first character is used as the lower bound. If vFromAsc is numeric (and not a numeric string), then that ASCII value will be used as the lower bound. Function returns vValue unchanged if vFromAsc is not string nor numeric.
vThruAsc String character or numeric ASCII value describing the upper bound of the range of characters to be removed from string vValue. Note: Special argument fix-up code. If vThruAsc is an empty string, then vValue is returned unchanged. If vThruAsc is a non-empty string, then the ASCII value of its first character is used as the upper bound. If vThruAsc is numeric (and not a numeric string), then that ASCII value will be used as the upper bound. Function returns vValue unchanged if vThruAsc is not string nor numeric. Function returns an empty string if vFromAsc is greater than vThruAsc.

Notes & Version History

Note Function uses the ASCII value of characters to determine if they fall within the range, which is in effect the same as using Binary comparisons.