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

Replace Value Of Type Function
Convert Values Class

Public Function ReplaceValueOfType( _
      ByVal vOriginal As Variant _
    , ByVal vFind As Variant _
    , ByVal vReplace As Variant _
    ) As Variant

"Replace One Value Of A Specific Type With Another Value"
Replaces some specific value of a specific type with another value.
Returns all other values unchanged.
Generally only supports numeric and string values.

Examples:
    ReplaceValueOfType(2%, 0%, 1%) = 2%
    ReplaceValueOfType(0%, 0%, 1%) = 1%
    ReplaceValueOfType(0%, 0!, 1!) = 0%
    ReplaceValueOfType(0!, 0!, 1!) = 1!
    IsNull(ReplaceValueOfType(Null, Null, 1)) = True ' #5
    IsNull(ReplaceValueOfType(Null, 0, 1)) = True
    IsNull(ReplaceValueOfType(0, 0, Null)) = True
See also:
    ReplaceValue Function
    ReplaceVarTypeWithValue Function
    VarType Function (Visual Basic)
vOriginal: The value whose value and data type are checked to see if they match vFind. Function returns vReplace if vOriginal equals vFind and VarType(vOriginal) equals VarType(vFind). Function returns vOriginal otherwise. vOriginal must be a numeric or string or Null value which is type-compatible with vFind.
vFind: The value whose value and data type are compared to vOriginal to determine what should be returned. vFind must be a numeric or string or Null value which is type-compatible with vOriginal.
vReplace: The value which is returned instead of vOriginal if both the value and data type of vOriginal matches that of vFind. vReplace must be a numeric, String, Empty, or Null value.
Note: Function performs Binary comparisons if vOriginal and vFind are strings.
Note: Function uses the Visual Basic "=" operator to determine if values match. Because of this, if either vOriginal or vFind are Null, no match will take place and vOriginal will be returned unchanged as in example #5.

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