Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mule MEL to do substring on a flow variable

Tags:

mule

mule-el

I have a variable my_variable with value as a dynamic URL like --

http://stackoverflow.com/questions/ask

I want to do a substring on this dynamic URL to find the string after last "/" i.e. in case above mentioned URL, I want to get the substring "ask"

How can I use MEL to do that?

like image 900
user1493140 Avatar asked Feb 13 '23 00:02

user1493140


1 Answers

You can use the string functions which are availalbe from the java.lang package.

#[flowVars['my_variable'].substring(flowVars['my_variable'].lastIndexOf('/'))]

Hope this helps.

like image 136
user1760178 Avatar answered Feb 26 '23 19:02

user1760178