Creating a filename from 2 variables, through concatenation.

I have 2 variables filename and extension. i need to create a full filename from it. the problem i am facing is that, is it possible to concatenate 3 objects together??

For e.g. the filename, a dot and the extension.

Cause i am only able to concatenate only the filename and extension.

And also is it possible to reverse the situation, that is take the full filename and make split it into 2 parts, removing the dot also.

please help!

You can use variable substitution: For inString1 pass filename. For inString2 initialize a value .%extension% and check ‘Perform variable substitution’ option.
Or invoke pub.string:concat service more times until u get the string u want.
Pls go though the built-in services guide.


There are also some PSUtilities available to perform these functions. You can use PSUtilities.string:multiConcat to concatinate several values together.

PSUtilities.regex:split can be used to search for a decimal point and return the values to the left and right of it in a sting list.

Either as gunasekhar says, use variable substitution, or use two or more concat calls to build the resulting string. The latter is probably a bit less efficient.

To split, use tokenize in WmPublic package.

Hi Assad,

Please make use of pub.string:makeString.
For e.g. you want to perform the following operation : “windows.txt”.
Here Filename : windows
dot : .
extension : txt
Then first declare 3 variables i.e filename , dot(setvalue to .) , extension(setValue to txt)
Then use pub.string:makeString and Map in the order which you want.
First Map variable filename to “elementList” and give indices… set to “0” since FlieName come first.
Then Map variable dot to “elementList” and give indices… set to “1” since dot comes next and then Map variable extension to “elementList” and give indices… set to “2”.

Then run it which gives windows.txt.

Try to change indices and observe the output.

Thanks ,
Sudheer Martha