Liquid UI - Documentation - 6.14 linerecordsplit()

6.14 linerecordsplit()


Purpose

With linerecordsplit(), you can break up a long string into its smaller strings, based on the parameters you define. You can specify the parts by using the 'label' and 'length' option pair as described below. This command is available in WS builds of 1.2.194.0 and above.


Syntax

var elementArr = linerecordsplit(z_string,[{"label":"NUMBERS","length":10},{"label":"ALPHABETS","length":20}]);
Note: The split will always start from the first character of the string. You cannot extract a portion of the original string from the middle.


Property

  • z_string - String variable.


Available Options

You can use the following options with the linerecordsplit:

"label, length":".."

"label":"string","length":size - Splits the string provided in the Label with respect to the corresponding length.


Options Detail

Label,Length

  1. The label and length are always pair with each other. The string in the label will split into specified character length. You can either use a single entry format or an array. The two possible syntax options are:

  2. Single Entry
    {"label":"string","length":20}
    Array
    [{"label":"string1","length":20},{"label":"string2","length":10}]
  3. var z_string="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    var elementArr = linerecordsplit(z_string,[{"label":"NUMBERS","length":10},{"label":"ALPHABETS","length":20}]);
    
  4. As per the code, the string will spilt in to two parts, the first part would be of 10 characters long and second part will be 20 characters long.


Example

In the following example, we will split a string into its component parts using the 'linerecordsplit' command.

  1. Create a string variable.

  2. Invoke the linerecordsplit() command using the Script code.

  3. In your script, print out the new components of the original string.

    var z_string="222334455689PoojithaTechnicalWriter";
    var elementArr = linerecordsplit(z_string,[{"label":"NUMBERS","length":10},{"label":"ALPHABETS","length":20}]);
    println(elementArr.NUMBERS);
    println(elementArr.ALPHABETS);

Can't find the answers you're looking for?