Search For

Substr - To Find Substring

Flag Hide Line Nos
Flagging a Snippet, takes the snippet to Moderator Attention;


3
SUBSTR Function is used to extract a portion of the string.

General Syntax
SUBSTR(string Input,int Start,[int Length])


Example : Remove First Two Characters
SUBSTR('abcdef',3)

Output
----------
cdef

In the above example, Informatica Returns the positions itself at 3rd character and returns the rest of the string. In Informatica, Start of the string is 1 and not 0

Example : Extract Third and Fourth Character
SUBSTR('abcdef',3,2)

Output
----------
cd


In the above example 2 characters are returned, starting from the 3rd character.

Substring can also be used to extract last few characters of the string. The below example shows how to extract last 3 characters from the string.
SUBSTR('abcdef',-3,3)

output
---------
def


Vote! You feel this code is working like charm ? Go a head Login and Press up arrow.
Didn't work ?, press down arrow and let us know the error in comments

Comments