From: Chris Dew Date: 2008-09-08T22:13:48+09:00 Subject: Re: convert ascii codes in a string to a string of characters Have you looked at http://www.zenspider.com/ZSS/Products/RubyInline/ ? You could write the conversion routine in C, which is efficient for customised byte manipulation. There may be an efficient Ruby solution, but this is one tool which could be used for the job. smitty wrote: > Is there a more efficient way to convert a string such as > "abcdef" to "abcdef" ? > > Currently I am doing the following: > a="abcdef" > a.delete!("&#") > ar = a.split(';') > arn = ar.collect { |s| Integer(s) } > s = arn.pack("U*") > puts "s=#{s.inspect}" > > I need to do this for thousands of records that are > loaded into a database, so I'm a bit concerned > about repeatedly executing all of the above code. > Thanks