Skip to content

Instantly share code, notes, and snippets.

@davebrny
Created November 15, 2017 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davebrny/53232e6360b2fb48fd5be6a737384a6a to your computer and use it in GitHub Desktop.
Save davebrny/53232e6360b2fb48fd5be6a737384a6a to your computer and use it in GitHub Desktop.
(autohotkey) - truncate a string
truncate(string, at, divider=" . . . . ") {
if (strLen(string) > at)
string := subStr(string, 1, at/2) . divider . subStr(string, -at/2)
return string
}
@davebrny
Copy link
Author

text := "abcdefghijklmnopqrstuvwxyz"
msgBox, % truncate(text, 7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment