split function in peoplecode

split function in peoplecode

You can using split function in peoplecode of peoplesoft.  This function to convert a string into an array of strings by looking for the string separator in the given string but this function does not split an array.

Split(string, separator)

If separator is omitted, a blank is used.
If separator is a null string (“”), the string is split into single characters.
If separator is the last character in the string, you will not get an empty string.

For example 1, in the following code, &array only has a value of 2:

&test = “value1:value2:”;
&array = Split(&test, “:”);

For example 2, you can get file and read file.

 

If &In_File.IsOpen Then
While &In_File.ReadLine(&file);
&line = Split(&file, “,”);
MessageBox(0, “Lenght of separate , in file”, 0, 0, ” i len= ” | &line.Len);
End-while;
End-if;

Reference: https://docs.oracle.com/cd/E13292_01/pt849pbr0/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl02.htm

Posted in Peoplecode, PeopleSoft.