最近搜索


没有最近搜索

Using Placeholder Text for to reduce to Initials



已于 2022年11月05日 发布

Hello!

Is there a way to reduce a placeholder from a full string to a partial string?  I have a use case where I'd need to reduce a full name into the first three letters of the first and last name.

Ex: John Smith -> JOH SMI

I have the first and last name of the requester available as placeholders but they are the full name.  Does anyone have creative ideas for how to reduce to just the first three digits?  Sort of like the left() function in excel?

Thanks!


0

1

1 条评论

Hi Caitlin

You can use something like 

{{ticket.requester.first_name | slice: 0,3}} {{ticket.requester.last_name| slice: 0,3}}

To get only the first three symbols of both parts.

And all in uppercase:

{{ticket.requester.first_name | slice: 0,3 | upcase}} {{ticket.requester.last_name | slice: 0,3 | upcase}}

Sources:

https://shopify.github.io/liquid/filters/slice/

https://shopify.github.io/liquid/filters/upcase/

0


请先登录再写评论。

找不到所需的内容?

新建帖子