We usually get the length of a string by length method. But it is not the correct result of the string which composites of chinese charaters because the chinese charaters will take 2 space for each. On the other side, one more method bytesize of String, will return the3, the bytes length of the string.

So, I define a function to get the result I want:

and make it as a monkey patch of String with the path of lib/core_extensions/string/kanji_size.rb: