Public Function ShortenString(s as string, maxLength as integer = 80) As String
// if short enough, just return the source String
if s.length <= maxLength then
return s
end if
// Otherwise, create a string from the left and right ends,
// and removing extra characters to make room for the ellipsis in the middle
// note: this probably requires ellipsis to have even length
var ellipsis as String = "...."
s = s.left(maxLength/2 - ellipsis.length/2 ) + "...." + s.right(maxLength/2 - ellipsis.length/2)
return s
End Function