IBM Support

JavaScript Example: Custom JavaScript function to replace a string with a carriage return (CR) and line feed (LF).

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

[{"Product":{"code":"SSGR73","label":"IBM Cast Iron Cloud Integration"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Not Applicable","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"},{"code":"PF009","label":"Firmware"}],"Version":"7.0.0.1;7.0.0;6.4.0.1;6.3.0.2;6.1.0.9;6.1.0.15;6.1.0.12","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

00001428

Product Synonym

Cast Iron Solution
Cast Iron Operating System
Cast Iron Studio

Document Information

More support for:
IBM Cast Iron Cloud Integration

Software version:
7.0.0.1, 7.0.0, 6.4.0.1, 6.3.0.2, 6.1.0.9, 6.1.0.15, 6.1.0.12

Operating system(s):
Linux, Windows, Firmware

Document number:
410607

Modified date:
15 June 2018

UID

swg21452789

Manage My Notification Subscriptions