How to concatenate the strings

Hi All,

My input is 1234
5678
9000

I need the output in the format of 1234,5678,9000.

i.e whatever the input I need to concatenate with ,(comma).
I need support to get the desire output.

@Gokul001
@ushu
@lakshman
@ppr
@Yoichi

Hi @Vrishchik ,

Try the below :

YourInputStr.Replace(Environment.NewLine,",")

@Vrishchik
Welcome to the forum

some details cannot be derived from above

Have a try at

myString = myInPutString.Replace(Environment.NewLine, ",")

assign this text to your output

System.text.regularExpressions.regex.replace(inputStringHere, "(?m)(\n)", ",")

where
the variable inputStringHere is your input
1234
5678
9000

If you have all those values assigned to one variable then
InputStr.Replace(Environment.NewLine,β€œ,”)

If each value above are assigned to different variables then
i.e., a = 1234 b = 5678 c = 9000
string.Concat(a+β€œ,”+b+β€œ,”+c)

1 Like

@Vrishchik ,
Check this
Concat.zip (1.3 KB)

image

Regards,

1 Like

Hi @Vrishchik

Welcome to UiPath community

How about this Regex expression

System.Text.RegularExpressions.Regex.replace(YourString,"(?<=\d)$",",").Tostring

Regards
Gokul

Hey @Vrishchik

image

Hope this helps
Cheers.

1 Like

ID

I need the output in the form of S39.012A,G89.29,M62.838,Z32.02

I.e each string should be separated by ,(comma)

Hey @Vrishchik
Is that a data table ?
Use this

strVariable = String.Join(β€œ,”,dt_Table.AsEnumerable().Select(function(arg as datarow) arg(β€œColumn1”).ToString))

Here, dt_Table is your data table and Column1 is the column here you have strings.
Hope this helps.
Cheers.

@Vrishchik use this

Sequence.xaml (7.6 KB)

input
image
output
image

Hi @Vrishchik ,

use the expression below:

String.join(β€œ,”,(From row in DT.AsEnumerable() where not string.IsNullOrEmpty(Convert.Tostring(row(β€œCode”))) Select Convert.Tostring(row(β€œCode”)) ).ToArray())

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.