Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First - Split - Join solution in Clear category for Cut Sentence by oduvan
def cut_sentence(line, length):
if len(line) <= length:
return line
if line[length] == ' ':
return line[:length] + '...'
return ' '.join(line[:length].split(' ')[:-1]) + '...'
July 24, 2017
Comments: