# Weird .split behavior

**URL:** <https://community.hubspot.com/t/weird-split-behavior/113967>\
**Category:** CMS Development\
**Created:** [August 7, 2024, 1:04pm UTC](https://community.hubspot.com/t/weird-split-behavior/113967 "2024-08-07T13:04:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArielAdes](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@ArielAdes](https://community.hubspot.com/u/ArielAdes)\
**Post date:** [August 7, 2024, 1:04pm UTC](https://community.hubspot.com/t/weird-split-behavior/113967/1 "2024-08-07T13:04:29Z")

</div>

Hi,

I’ve being strugling with this for a few days now. I have a really weird behavior when trying to split a costumer propriety into my e-mail template.

First - the basics… I created an email with the following code:

```lia-code-sample
{% set navigation = ["Home", "About"] %}
{% do navigation.append("Contact Us") %}
{{navigation|pprint}}<br>

{% for item in navigation %}
 <li>{{item}}</li>
{% endfor %}

```

That worked as expected and the result was:

```lia-code-sample
(SizeLimitingPyList: [Home, About, Contact Us])
- Home
- About
- Contact Us

```

So far so good…

Next I created a property into my contacts (I’ve tried single line and multiline text). The property contains the following text:

`Home;About`

Finally I’ve altered my email template code to split on the ; (everything else is the same):

```lia-code-sample
{% set navigation = contact.test_prop_single_line|split(';') %}
{% do navigation.append("Contact Us") %}
{{navigation|pprint}}<br>
{% for item in navigation %}
 <li>{{item}}</li>
{% endfor %}

```

However now I get this weird result:

```lia-code-sample
(SizeLimitingPyList: [Home;About, Contact Us])
- Home;About
- Contact Us

```

It’s as the split didnt do anything but to convert the string into a list with one element (ignoring the ; character).

Trying the personalization\_token it gets even worst:

```lia-code-sample
{% set navigation = personalization_token('contact.test_prop_single_line', '')|split(';') %}
{% do navigation.append("Contact Us") %}
{{navigation|pprint}}<br>
{% for item in navigation %}
 <li>{{item}}</li>
{% endfor %}

```

Outputs:

```lia-code-sample
(SizeLimitingPyList: [{",objectExpression", :", contact_without_defaults.test_prop_single_line", ,",defaultExpression", :", contact.test_prop_single_line", ,",localDefault", :", ", }, Contact Us])
- \{\{personalization_token_internal({"
- objectExpression"
- :"
- contact_without_defaults.test_prop_single_line"
- ,"
- defaultExpression"
- :"
- contact.test_prop_single_line"
- ,"
- localDefault"
- :"
- "
- })\}\}
- Contact Us

```

Now the split seems to have worked, but it’s splitting into the , and not the ; (and its not getting the actual content of my property)

Any clue what I’m doing wrong? I’ve tried different separators as well - like ` or | but i always get one of the 2 scenarios above.

Ty!

---

<div class="post-metadata">

**Author:** ![ArielAdes](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@ArielAdes](https://community.hubspot.com/u/ArielAdes)\
**Post date:** [August 7, 2024, 1:30pm UTC](https://community.hubspot.com/t/weird-split-behavior/113967/2 "2024-08-07T13:30:03Z")

</div>

Adding to the weirdness - replace isnt working as well (its almost like the property isnt a string!):

```lia-code-sample
{% set navigation = contact. test_prop_single_line|replace("|", "`") %}
{% do navigation.append("Contact Us") %}
{{navigation}}<br>
{{navigation|pprint}}<br>
{% for item in navigation %}
 <li>{{item}}</li>
{% endfor %}

```

Returns

```lia-code-sample
Home|About
(String: Home|About)
- Home|About

```

Something is really messed up here…
