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

Remove Some Characters Function
Codes Ciphers Class

Public Function RemoveSomeCharacters( _
      ByVal vValue As Variant _
    , Optional ByVal vRemoveRatio As Variant _
    , Optional ByVal vRandomly As Variant _
    ) As Variant

Randomly or systematically remove some of the characters from a string.
vRemoveRatio should be between 0 and 1.

    RemoveSomeCharacters("This is a test.", 0.0) = "This is a test."
    RemoveSomeCharacters("This is a test.", .33) = "Tis is tes"
    RemoveSomeCharacters("This is a test.", .67) = "Tsste"
    RemoveSomeCharacters("This is a test.", 1.0) = ""
    RemoveSomeCharacters("This is a test.", 0.5, False) = "Ti sats."
See also:
    RemoveSomeVowels Function
    CharacterTypes Class
vValue: String from which some characters are to be removed. Function returns Null if vValue is Null or cannot be fixed up to a String.

vRemoveRatio: The ratio of characters within string vValue that are to be removed. A ratio of 0 (zero) tells the function to remove no characters, .33 would tell it to remove 1/3 (one third) of the characters, and a ratio of 1 (one) tells it to remove all characters. vRemoveRatio defaults to .25 (25% of characters will removed) if it is missing or Null or cannot be fixed up to a number.

Function returns vValue unchanged if vRemoveRatio is <= 0 (less than or equal to zero).

Function returns an empty string if vRemoveRatio is >= 1 (greater than or equal to one).

vRandomly: True if characters are to be removed randomly, or False if characters are to be removed systematically. If True, then the behavior of this function is non-random and repeatable given the same values for all arguments.

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