ruby binary string compare -


i want clarify understanding of string comparison in ruby.

how ruby compare binary strings?

does (a) split strings on utf-8 characters, compare strings based on length of binary string in utf-8 characters , values of utf-8 characters, or (b) compare strings on byte level?

it depends on version of ruby you're using

in ruby 1.8, strings collection of bytes.

in ruby 1.9, strings collection of encoded data.

string comparisons in ruby 1.9 done on byte level, other operations regex matches not. best normalize string objects same encoding before comparing them.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -