Download CFReplace
Scenario: You want to format a number so it uses a comma for a number seporator. How can this be done? With CFReplace of course.
answer CFReplace("10000000000","000",",000","","kCFCompareBackwards","kCFCompareAnchored")
That was simple enough. But now for the syntax.
Syntax:
CFReplace(<theString>,<searchString>,<replaceString>,[<Range(ie: 10,20)>][,<compareFlag1>,<compareFlag2>...])
The Params:
theString - This is the string you want to perform the replace on.
searchString - The string to replace.
replaceString - The string to use instead of the searchString.
Range - This is a range to preform the replace on. For example, 1,10 means replace the searchString with the replace string on chars 1 thru 10 of theString. If you want to replace the entire contents just enter empty quotes for this param. ""
compareFlag1..2… - The following is a list of acceptable compareFlags that can be used with this external.
- kCFCompareCaseInsensitive
- kCFCompareBackwards
- kCFCompareNonliteral
- kCFCompareAnchored
- kCFCompareNumerically
- kCFCompareLocalized
- default
You can combine them in the next 12 params to customise the way this external searches through the text to perform the replace.
|