The string to shorten
Optional
startCount: numberThe number of characters to keep at the start of the string
Optional
endCount: numberThe number of characters to keep at the end of the string
Optional
ellipse: stringThe string to use as the ellipse (default: '...')
The shortened string
shortenString('0x7a7a7229292286592739473748234343434532345', 4, 4) // '0x7a...2345'
shortenString('0x7a7a7229292286592739473748234343434532345', 4, 4, '***') // '0x7a***2345'
shortenString('0x7a7a7229292286592739473748234343434532345', 6, 4, '...') // '0x7a7a...2345'
Shortens a string by removing characters from the middle and replacing them with an ellipse.