Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- how to add spaces while concatenating data from 2 lists?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 1, 2019 8:21 PM
(812 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

3 REPLIES 3

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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";