stefangs Posted April 1, 2003 Share Posted April 1, 2003 is it possible to nest the substitute function? i'd like to do something like this: textinputfield: "Please substitute aaa for bbb." textoutputcalc: "Please substitute apples for oranges." i could do this with two calc fields like this: textoutput1 = Substitute(textinput, "aaa", "apples") textoutput2 = Substitute(textoutput1, "bbb", "oranges") but that seems not particularly elegant, especially since each additional substitution would require an additional calc field. Link to comment Share on other sites More sharing options...
slstrother Posted April 1, 2003 Share Posted April 1, 2003 A nested Substitute function is as follows: Substitute(Substitute(text, search string, replace string), search string, replace string) Link to comment Share on other sites More sharing options...
Vaughan Posted April 2, 2003 Share Posted April 2, 2003 There is a limit to the number of nested substitutions, the limit depends on the version you use. Either way, if you hit the limit you can split the calculation between two or more calculation fields exactly the way you proposed in your first post. Link to comment Share on other sites More sharing options...
cjaeger Posted April 2, 2003 Share Posted April 2, 2003 25 nested substitutes should be safe. just make sure you dont substitute anythin twice, aka substitute(fsubstitute(field,"xxx";"grappler");"apple";"trash") Link to comment Share on other sites More sharing options...
stefangs Posted April 3, 2003 Author Share Posted April 3, 2003 thanks everyone - glad it can be done! Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 7854 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now