Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

String split in sightly


Level 4

Hi All,

Is it possible to do string split in sightly. 

For example I have string x = "C-123-coursename"; I want to remove the course name and get C-123. How can i do this in sightly?



0 Replies


Level 10

You can take help of javascript use api available in sightly

split using normal split() function and return value from file to sightly file

Here is one basic example available:[the link no longer available and removed by Mod]


Community Advisor

Sightly templating script is designed not to have such logics other than just rendering piece of it. As @edubey mentioned, you can use JS Use API or do all that operations in your Sightly model or sling model class itself and send the actual value which needs to be displayed.


Level 10

If you want to know more about Sightly - watch out for this Months Ask the AEM COmmunity Experts. We will be doing a deep dive into Sightly.