JointLantic

substitute and replace peoplecode

substitute and replace peoplecode

Different substitute and replace peoplecode function of peoplesoft.

Use the Substitute function to replace every occurrence of a substring found in a string with a new substring. To replace text that occurs in a specific location in a text string using the Replace function.

The syntax of Substitute:  

Substitute(source_text, old_text, new_text)

source_text is a string in which you want to replace substrings.
old_text is a string equal to the substring of source_text you want to replace.

For example 1

Substitute(“2003* 0723* * * * ~”, “* ~”, “~”);

The result:  2003~0723~~~~~

 

Replace function to replace a specified number of characters in a string.

Syntax: Replace(old_text, start, num_chars, new_text)

old_text: A String value, part of which is to be replaced.
start: A Number designating the position in old_text from which to start replacing characters.
num_chars: A Number, specifying how many characters to replace in old_text.
new_text: A String value that replaces num_chars characters.

For example 2

Replace(“2000″,3,2,”18”);

The result of example 2 is  2018

For example 3

Replace(“MeeToo”,4,3,”kkk”);

The result of example 2 is  Meekkk

 

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

Exit mobile version