I want to concatenate the strings with the condition like as below:
If a column contains only one value no need to concatenate, else need to be concatenate and the value is dynamic i.e sometime the value might be one or two or three or four etc.
I need to concatenate using comma","
for ex if the input is 96372 93672
then output should be x=96372,93672
I dont want to splitt, I need to join using comma(“,”)
the output should be: 1234,5678
we did, as you can see the usage of String Join and also the surrounding " "
variable name is strCPTCode
Als have a look on some alternates:
that variable contains the value after scrapping
"96372 93672".Replace(" ",",")
Can you try this approach
- Split the input string based on the space delimiter into a list of individual strings.
- Check if the length of the list is equal to 1. If it is, return the input string as is without any concatenation.
- If the length of the list is greater than 1, join the elements of the list using a comma separator.
- Return the concatenated string.
Can you please elaborate with expression please??
just do one thing:
- read again and go through the presented approaches and building blocks
- use the immediate panel and explore it by doing some practicals
e.g. when variable is to use then just modify the statement and test it within the immediate panel