Vrishchik
(Naveenkumar Shivaraju)
April 14, 2023, 8:11am
1
Hi All,
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
@vishal.kp
@Nitya1
@ppr
@Yoichi
@ushu
Vrishchik
(Naveenkumar Shivaraju)
April 14, 2023, 8:18am
3
I dont want to splitt, I need to join using comma(“,”)
for ex:
1234
5678
the output should be: 1234,5678
ppr
(Peter Preuss)
April 14, 2023, 8:18am
4
we did, as you can see the usage of String Join and also the surrounding " "
Vrishchik
(Naveenkumar Shivaraju)
April 14, 2023, 8:23am
5
variable name is strCPTCode
ppr
(Peter Preuss)
April 14, 2023, 8:23am
6
Als have a look on some alternates:
Vrishchik
(Naveenkumar Shivaraju)
April 14, 2023, 8:24am
7
that variable contains the value after scrapping
1234,
5678
etc
Hi @Vrishchik
Try this.
"96372 93672".Replace(" ",",")
Nitya1
(Nitya Tomar)
April 14, 2023, 8:28am
9
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.
Vrishchik
(Naveenkumar Shivaraju)
April 14, 2023, 8:40am
10
Can you please elaborate with expression please??
ppr
(Peter Preuss)
April 14, 2023, 8:47am
11
@Vrishchik
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