Get and trim the length of a string.