summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-ext/mrblib/string.rb
AgeCommit message (Collapse)Author
2020-10-15Merge branch 'work_for_merge' of https://github.com/zubycz/mruby into ↵Yukihiro "Matz" Matsumoto
zubycz-work_for_merge
2020-10-13Introduce endless range (a part of #5085)taiyoslime
Co-Authored-By: n4o847 <[email protected]> Co-Authored-By: smallkirby <[email protected]>
2020-10-12Remove unnecessary assignment in String#upton4o847
Co-authored-by: taiyoslime <[email protected]> Co-authored-by: smallkirby <[email protected]>
2019-07-23Add encoding argument to `Integral#chr`KOBAYASHI Shuji
Currently, `Integral#chr` in mruby changes behavior by `MRB_UTF8_STRING` setting. before this patch: $ bin/mruby -e 'p 171.chr' #=> "\xab" (`MRB_UTF8_STRING` is disabled) $ bin/mruby -e 'p 171.chr' #=> "«" (`MRB_UTF8_STRING` is enabled) This behavior is incompatible with Ruby, and a little inconvenient because it can't be interpreted as ASCII-8BIT with `MRB_UTF8_STRING`, I think. So add encoding argument according to Ruby. after this patch: $ bin/mruby -e 'p 171.chr' #=> "\xab" $ bin/mruby -e 'p 171.chr("ASCII-8BIT")' #=> "\xab" $ bin/mruby -e 'p 171.chr("UTF-8")' #=> "«" Allow only `String` for encoding because mruby doesn't have `Encoding` class, and `"ASCII-8BIT"` (`"BINARY"`) and `"UTF-8"` (only with `MRB_UTF8_STRING`) are valid value (default is `"ASCII-8BIT"`).
2019-04-27Remove duplicated `String#each_char`KOBAYASHI Shuji
2019-03-15Use `FrozenError` instead of `RuntimeError` in `String#rstrip!`KOBAYASHI Shuji
2018-11-19Removed `String#try_convert` method from `mruby-string-ext` gem.Yukihiro "Matz" Matsumoto
Because `try_convert` method rarely used in production. For mruby users, we have `__to_str` utility method to check string type.
2018-11-19Remove implicit conversion using `to_str` method; fix #3854Yukihiro "Matz" Matsumoto
We have added internal convenience method `__to_str` which does string type check. The issue #3854 was fixed but fundamental flaw of lack of stack depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA` for workaround.
2018-04-21Implement `String#upto` in Ruby.Yukihiro "Matz" Matsumoto
Avoid using `mrb_yield` in C code. The function is not recommended. Because it doesn't work well with fibers.
2018-04-19CRuby2.6 stops deprecating `String#lines` with a block.Yukihiro "Matz" Matsumoto
`String#lines` (with a block) is now implemented in Ruby.
2017-12-12Modifying frozen objects will raise `FrozenError`.Yukihiro "Matz" Matsumoto
`FrozenError` is a subclass of `RuntimeError` which used to be raised. [Ruby2.5]
2017-10-17Add `{String,Symbol}#casecmp?`; CRuby2.4Yukihiro "Matz" Matsumoto
2017-06-14Reimplement String#uptoksss
2017-03-10Terminate loop if generated string longer than the last; ref #3489Yukihiro "Matz" Matsumoto
2017-03-05Check modifiable for String `bang' methodsksss
2017-02-10String#ljust and String#rjust reimplemented with optimized RubyTomasz Dabrowski
2017-02-10String#ljust and String#rjust reimplementation (fix #3445)Tomasz Dabrowski
- String#ljust and String#rjust are now C functions to improve performance - infinite loop because of an empty padding argument is now prevented (ArgumentError is raised) - extra tests for ljust/rjust added
2017-01-04Rewrite String#prepend with Rubyksss
Fix #3357
2016-11-17String#{strip,lstrip,rstrip} may cause OOB accessYukihiro "Matz" Matsumoto
2016-09-28Removed trailing spacesNobuyoshi Nakada
2016-07-27Reduce needless Array generation in some String methodsKouhei Sutou
Here are some benchmarks: each_char: # /tmp/each_char.rb a = "a" * 1000000 a.each_char do |x| end Without this change: % time bin/mruby /tmp/each_char.rb bin/mruby /tmp/each_char.rb 1.07s user 0.02s system 99% cpu 1.088 total With this change: % time bin/mruby /tmp/each_char.rb bin/mruby /tmp/each_char.rb 0.52s user 0.01s system 99% cpu 0.530 total 2 times faster with this change. codepoints: # /tmp/codepoints.rb a = "a" * 1000000 a.codepoints do |x| end Without this change: % time bin/mruby /tmp/codepoints.rb bin/mruby /tmp/codepoints.rb 1.16s user 0.05s system 99% cpu 1.216 total With this change: % time bin/mruby /tmp/codepoints.rb bin/mruby /tmp/codepoints.rb 0.56s user 0.02s system 99% cpu 0.589 total
2016-07-26Support to call without block to String#each_charksss
2016-07-14String#insert should be destructiveksss
2016-01-30Add String#rjust to mruby-string-extAkira Moroo
2015-11-24add {Array|Hash|String}.try_converttakahashim
2015-09-24UTF-8 string support in coreYukihiro "Matz" Matsumoto
define MRB_UTF8_STRING (in mrbconf.h) to enable UTF-8 support.
2015-08-22Use #nil? instead of == nil.INOUE Yasuyuki
2015-01-13Add String#uptoJun Hiroe
2015-01-12add String#ljust into mruby-string-exttakahashim
2014-12-13Add String#insertJun Hiroe
2014-11-23Fix String#slice! raise TypeError or return invalid value.TOMITA Masahiro
2014-06-19Modify return value of String#slice! if idx == self.sizeAkito Mochizuki
2014-06-15Implement String#slice_bangJun Hiroe
2014-06-11String#clear: use String#replace to simpleksss
2014-06-03Merge pull request #2346 from suzukaze/add-string-comment2Yukihiro "Matz" Matsumoto
Fix indent in String#casecmp comments
2014-06-02Fix indent in String#casecmp commentsJun Hiroe
2014-06-02Add comments in String#lstrip, rstrip, strip, lstring_bang, rstrip_bang and ↵Jun Hiroe
strip_bang
2014-04-20String#casecmp should be call `to_str`ksss
when non String object sent And should be raise TypeError when can not responsed to `to_str`
2013-12-27add String#partition and String#rpartition.Tomoyuki Sahara
2013-04-19Add String#swapcase,swapcase!,concat,casecmp,start_with,end_withh2so5
2013-03-08add "strip" family to String.Tomoyuki Sahara