Crystal Reports: Substitute() Function

Similar to Crystal’s Replace function, but Substitute allows for an array of Find values.


Function Substitute (Source As String, Find() As String, Replacement As String) As String
Dim i As Number
For i = 1 To Ubound(Find)
Source=Replace(Source,Find(i),Substitute)
Next
Strip = Source
End Function

Parameters

Source
The original string
Find
Array of values to be found
Replacement
Character to be substituted for values that are found.

Return Value

A string value.

Remarks

none

Example


'removes *,% and ? characters from the parameter's value
Substitute({?My Parameter},["*","%","?"],"")

Requirements

This function requires the use of Basic Syntax.

Leave a Reply

Your email address will not be published. Required fields are marked *