built in service which gives the last 4 characters of a string

hi experts,
can anybody tell me if there is any built in service which we can call and give it a string input while it gives me the last four digits of that string as output.
example :
string input :- filename:0001
string output:-0001
i just need the number out of it ,
and the input string is the file name which i get from a polling directory.
i use
pub.flow:getTransportInfo, to get the file name.
thanks
srikanth

If you string has (:slight_smile: always in the filename as you mentioned use pub.string:tokenize (set delmiter :)then extract the index[1] from valueList output map it to a new string gives 0001

HTH,
RMG

Shrikath,

You can use a combination of two built-in services to achieve your goal. Lets say your input string is in the variable named “filename”. First use pub.string:length to get the length of the filename in a variable “len”, then use pub.string:substring to get the last 4 chars of the filename. When using the substring service map your filename to the inString, len-4 to beginIndex and len to endIndex.

HTH, Rohit

1 Like