From: "Pål Bergström" Date: 2008-08-20T02:02:28+09:00 Subject: Re: Cut a string if length > n Ara Howard wrote: > On Aug 19, 2008, at 9:25 AM, P�l Bergstr�m wrote: > >> What's the best way to cut a string if the length is above n >> characters? >> Is it slice, or is there any other convenient method? Trying to >> understand the string class from the docs but not sure which one to >> use. > > > this_always_works = string[ 0 .. n ] > > regardless of whether the string is <, =, or > than n > > a @ http://codeforpeople.com/ Found a problem with this. It messes up swedish letters that, I guess, is cut right of as if they where handled as latin1. What method can handle utf-8? -- Posted via http://www.ruby-forum.com/.