Lava Filters - Split

Category:Text

Description:Splits a string into an array based on a matching pattern.
Input: "Person": { "Email": "ted@rocksolidchurchdemo.com" } "Item": { "Title": "Topic: Man vs 10:00" }
Lava: // Simple example {% assign emailParts = CurrentPerson.Email | Split:'@' %} Your email domain is: {{ emailParts[1] }}. // Split with Maximum option {% assign stringParts = item.Title | Split:':', 2 %} The first part is: {{ stringParts[0] }} The second part is: {{ stringParts[1] }} // Split with Remove Empty false and Maximum option {% assign itemsList = "A,B,,D,E,F,G" | Split:',', false, 4 %} The first part is: {{ itemsList[0] }} The second part is: {{ itemsList[1] }} The third part is: {{ itemsList[2] }} The fourth part is: {{ itemsList[3] }}
Output: Your email domain is: rocksolidchurchdemo.com. The first part is: Topic The second part is: Man vs 10:00 The first part is: A The second part is: B The third part is: The fourth part is: D,E,F,G The fifth part is: