Truncates a string in the middle by replacing the middle portion with an ellipsis.
This function preserves the beginning and ending portions of the string while replacing
the middle section with "..." when the string exceeds a certain length.
Parameters
str: string
The original string to truncate
strPositionStart: number
Number of characters to preserve from the beginning
strPositionEnd: number
Number of characters to preserve from the end
Returns string
The truncated string or the original if no truncation is needed
Truncates a string in the middle by replacing the middle portion with an ellipsis.
This function preserves the beginning and ending portions of the string while replacing the middle section with "..." when the string exceeds a certain length.