[
https://issues.apache.org/jira/browse/FREEMARKER-219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dániel Dékány resolved FREEMARKER-219.
--------------------------------------
Resolution: Fixed
After some consideration I decided to add one exception to the existing rules,
which is that if the terminator string is 0 length, then we don't add a
separating space before it when the cut was on a word boundary. So then the
output is more intuitive for your case. But it still does trim around the cut.
So again, I suspect you want to use {{{}someString[0 ..* maxLength]{}}}.
> truncate_c is not working as expected
> -------------------------------------
>
> Key: FREEMARKER-219
> URL: https://issues.apache.org/jira/browse/FREEMARKER-219
> Project: Apache Freemarker
> Issue Type: Bug
> Components: engine
> Affects Versions: 2.3.31
> Reporter: Mirlan
> Assignee: Dániel Dékány
> Priority: Major
>
> So the String I would like to truncate is {{1234 SOMESTREETSSS AVE NE 123}}
> So the code is as below
> <#assign myField = "1234 SOMESTREETSSS AVE NE 123">
> ${myField?truncate_c(25, '')}
> {{}}
> Expected output is {{1234 SOMESTREETSSS AVE NE}}
> Actual output is {{1234 SOMESTREETSSS AVE N}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)