cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Choose Language Hide Translation Bar
ENTHU
Level IV

how to add spaces while concatenating data from 2 lists?

I have 3 lists and each list conatins 1 item. I need to concatenate 3 items to get 1 string. But not been able to get spaces between the 3 words of the string.How can I do this?

1 ACCEPTED SOLUTION

Accepted Solutions
ron_horne
Super User (Alumni)

Re: how to add spaces while concatenating data from 2 lists?

Hi @ENTHU 

it would be useful if you gave a bit of context such as a little script of table. otherwise try this:

str1 = "one";
str2 = "two";
str3 = "three";
 
comb = Concat Items({str1, str2, str3}, " ");

Ron

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: how to add spaces while concatenating data from 2 lists?

I am not sure exactly what you are asking for, but the code below, takes 2 lists and adds a blank entry between the concatenation of the two lists.

a={"one","two"};
b={"three","four"};
c=a|| {" "} || b;
Jim
ron_horne
Super User (Alumni)

Re: how to add spaces while concatenating data from 2 lists?

Hi @ENTHU 

it would be useful if you gave a bit of context such as a little script of table. otherwise try this:

str1 = "one";
str2 = "two";
str3 = "three";
 
comb = Concat Items({str1, str2, str3}, " ");

Ron

pmroz
Super User

Re: how to add spaces while concatenating data from 2 lists?

Here's a simple solution:

list1 = {"abc"};
list2 = {"def"};
list3 = {"ghi"};
concat_string = list1[1] || " " || list2[1] || " " || list3[1];
show(concat_string);

Result from the log:

concat_string = "abc def ghi";