How extract part of filename and assign to string var

Hello group.

I need to be able to do the following and wanted to know if anyone here can help me. I have a filename that I receive that comes in a format that looks like this:

FILExxxxx.cbkxxxx.pov

I need to be able to extract the cbkxxxx from the file and assign it to a string variable. I have to be able to somehow say “look at the filename string, look for cbk and take the value up to the .pov and assign it to a string variable”. How do you do that in developer? Currently, I have a substring set up, but it’s possible that the position of the cbkxxxx could be different.

Thanks.

Use pub.string:tokenize. Use . as your delim. Your cbkxxx will be in the second position in the returned valueList.

If the cbkxxxx section is always bracketed by periods one way to do this would be to tokenize (pub.string:tokenize) the file name using ‘.’ as the delimiter, then loop through the resulting string list checking for a value beginning with cbk.

Tim

or u can loop over the value list and as u know u have the value u need in valuelist[1] i.e in second position …just use the iterator and when it is 1 just map the value to a string and use it …
HTH
sri

If the part of the name will always be in the same place, just use an index to retrieve the desired entry from the array. No need to loop.

yeah thats right …give value list as input to pub.list:getStringListItem and specify index value …u can strip off the value u want …
HTH
sri

Hey,

Invocation of the service is also not needed. You may just map the string list to the string and give the index on tha map step

Rgds,
Pradeep

yeah thats true …solution by pradeep is pretty simple