cancel
Showing results for 
Search instead for 
Did you mean: 

Right substring function in CPI Graphical mapping

aditya_20
Explorer
0 Kudos

Hello all,

Is there any function available for performing right substring in cpi graphical mapping?

If not can anyone help me with groovy script for the performing the right substring function?

Thanks in advance

Aditya

View Entire Topic
Andrzej_Filusz
Contributor
0 Kudos

Hello Aditya,

Could you please check the following code:

def String rightSubstring(String str, int pos) {
    if (pos < 0) {
        throw new StringIndexOutOfBoundsException(pos)
    }
    if (str) {
        int length = str.length()
        if (length > pos)
            return str.substring(length - pos)
        else
            return str
    } else
        return str
}

BR,

Andrzej

 

aditya_20
Explorer
0 Kudos

Hi Andrzej,

Yes the script is working.

Thanks