Shared Action: ReplaceChars

MINI LESSONS ›› Actions Editor ›› Shared Actions ›› Library ››

MINI LESSON

For general information on what a Shared Action is, and how they are used within ToolBook, click here.


REPLACECHARS

This Shared Action (from a collection of pre-written Shared Actions) will permit you to replace any series of characters in a string, with another string.


The ReplaceChars shared action is the equivalent of saying in OpenScript:


  characters a to b of c = d


This will allow you to replace a series of characters within a string, with a different string. It requires four parameters - the original string, the start character position, the end character position and the string to use as a replacement. It will return a value representing the new string.


For example, perhaps you need to change this:


  "Call the customer at 555-123-1234 to follow-up"


to:


  "Call the customer at <unlisted> to follow-up"


masking the phone number with a statement of <unlisted>. You'd essentially be trying to say:


  c = "Call the customer at 555-123-1234 to follow-up"

  characters 22 to 33 of c = "<unlisted>"




Example of how to call this Shared Action from within your own Actions Script:


   


The Execute Shared Actions line of code has a full Property Editor that you can use to specify the values for the various parameters required by the Shared Action.


To access it:


  1. Select the Execute Shared Actions line of script in your code
  2. Click the Properties button in the Toolbar


The properties dialog will allow you to specify which values will be passed into this Shared Action and which variable will be used to receive the resulting return value.


   


DOWNLOAD INFORMATION

For general information on what a Shared Action is, and how they are used within ToolBook, click here.



ReplaceChars Shared Action



Created with the Personal Edition of HelpNDoc: Easily create EPub books