Troubleshooting
Problem
JavaScript Example: Custom JavaScript function to replace a string with a carriage return (CR) and line feed (LF).
Resolving The Problem
The following JavaScript executes a case-insensitive global search for the string in <find> and replaces it with a carriage return and line feed (CRLF). This custom JavaScript can be useful when formatting data.
To use the custom JavaScript, replace the string <find> with the desired string that needs to be replaced with a carriage return and line feed. Then paste the code into the Cast Iron Studio Custom Function window. Test the function with some test data and verify the results.
JavaScript code:
instr=instr.replace(/<find>/gi, "\r\n");
return instr
Example:
Input string = 'Cast-Iron'
<find>= '-'
Output result string:
Cast
Iron
Historical Number
00001428
Product Synonym
Cast Iron Solution;Cast Iron Operating System;Cast Iron Studio
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21452789