创建一个自定义函数来“补充” Replace() 函数:
// ----------------------------------------------------------------------
// ReplaceEx()
// Author: Craig Buchanan
// Purpose: Support an array of find tokens
// Parameters: text - the string being searched
// find - an array of characters to be found
// replacement - value to substitute
// ----------------------------------------------------------------------
Function (Stringvar text, Stringvar Array find, Stringvar replacement)
local numbervar i;
For i:=1 To Ubound(find) do (
text:=Replace(text, find[i], replacement)
);
text;
在公式字段中使用自定义函数:
// returns {612) 555-1212
Picture(ReplaceEx("612-555-1212", ["(",")","-"], ""), "(xxx) xxx-xxxx")