Choose Language Hide Translation Bar
Highlighted
ENTHU
Level III

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
Highlighted
ron_horne
Super User

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
Highlighted
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
Highlighted
ron_horne
Super User

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

Highlighted
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";
Article Labels

    There are no labels assigned to this post.