a version of code points

strings and encodings are definitely not the same for mir and opal
the code point version works for me with utf16 encoding (on my machine?)
utf16 is sensible choice though may go with it
This commit is contained in:
Torsten Ruger 2015-11-09 00:04:31 +02:00
parent 7c18ab3e36
commit dee9eb4dca
1 changed files with 15 additions and 0 deletions

View File

@ -20,6 +20,21 @@ require "views/instruction_view"
require "views/registers_view"
class Bignum
end
class String
def codepoints
arr = []
one = nil
self.each_byte do |c|
if( one )
arr << (one + c * 256)
one = nil
else
one = c
end
end
arr
end
end
class MainView < ListView
include AST::Sexp