iterate binary string and sqlite3 query

Hi guys, my problem is the following,

Right now I have a list of japanese words that are loaded from the database, they display okay, the problem begins when I need to split that word into 'characters' in this case 'kanjis' so I can make a link for each kanji,for example:

okay lol forget about the "nil" problem I mentioned at the end, that was because out of the huge list of words there were a few that started with a symbol other than a kanji so just doing:

"k.id unless k.nil?" did the trick

so I'm going to change my question to... is there another(simpler) way to do this? right now my helper looks like crap, I mean... like this:

okay lol forget about the "nil" problem I mentioned at the end, that was because out of the huge list of words there were a few that started with a symbol other than a kanji so just doing:

"k.id unless k.nil?" did the trick

so I'm going to change my question to... is there another(simpler) way to do this? right now my helper looks like crap, I mean... like this:

************************************* def word_to_links(word) parts, o = , "" (word.size/3).times{ |i| parts << word[i*3,3] }

I wouldn't rely on some or most kanjis being exactly 3 bytes in utf8 - use the multibyte chars stuff in activesupport

Fred

Frederick Cheung wrote: