string (must be valid UTF)
slice of str
assert(chop("hello world") == "hello worl"); assert(chop("hello world\n") == "hello world"); assert(chop("hello world\r") == "hello world"); assert(chop("hello world\n\r") == "hello world\n"); assert(chop("hello world\r\n") == "hello world"); assert(chop("Walter Bright") == "Walter Brigh"); assert(chop("") == "");
Returns str without its last character, if there is one. If str ends with "\r\n", then both are removed. If str is empty, then it is returned unchanged.