Permalink
Browse files

Naive / incomplete (base 10 only) version of String#to_i

  • Loading branch information...
vidarh committed Sep 11, 2014
1 parent d734bb4 commit 814b52007a45d7359db71f7b959dd5749fdb970e
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/core/string.rb
View
@@ -118,6 +118,12 @@ def to_sym
end
def to_i
i = 0
each_byte do |s|
return i if !(?0..?9).member?(s)
i = i*10 + s - ?0
end
i
end
def slice!(b,e)

0 comments on commit 814b520

Please sign in to comment.