What should I call an operation that limits the length of a string?

This is a language-agnostic question - if you do not consider English as a language.

I have a list of items that can have very long names.

For aesthetic purposes, in some cases, these names should be shorter by adding periods (...) to indicate that the name is larger. So, for example, if article.name returns this:

lorem ipsum dolor sit amet

I want to get this other result.

lorem ipsum dolor ...

I can program this quite easily. My question is: how can I call this reduction operation? I mean the name, not the implementation. Does it have a standard English name?

+3
source share
5 answers

. TruncateWithEllipsis - .

+9

truncate : Cut something as if by cutting off part of it.

Source

+2
source

Although it is less explicit than Thomas' TruncateWithEllipsis, I could call it abbreviatebecause I can cut things down differently in the future, either depending on the context, or what I'm cutting back on.

+1
source

Source: https://habr.com/ru/post/1746021/


All Articles