From: akbarhome Date: 2007-05-07T18:15:08+09:00 Subject: Re: separate Chinese and English! with Ruby On May 7, 2:39 pm, Nanyang Zhan wrote:> Don't get me wrong, because I just want to know how to separate English> words from a string with ruby.> There are strings (UTF-8 encoded) to record people's name,> like:>> 摩根·弗里曼 Morgan Freeman> 布鲁斯·威利斯 Bruce Willis> 李小明 Lee xiao ming> these strings containing Chinese name(without space between characters),> separated by a space, following an English name>> or> Frank Darabont> Just an English name.>> Would you give me an idea how to separate these Chinese characters(if> any)?>> --> Posted viahttp://www.ruby-forum.com/. a = File.open('a.txt') a.each {|x| puts x.split(' ', 2) }Output:摩根·弗里曼Morgan Freeman布鲁斯·威利斯Bruce Willis李小明Lee xiao ming