Yukihiro "Matz" Matsumoto
bbb0882343
Modifying frozen objects will raise FrozenError.
...
`FrozenError` is a subclass of `RuntimeError` which used to be
raised. [Ruby2.5]
2017-12-12 18:41:18 +09:00
Yukihiro "Matz" Matsumoto
4122c320bb
Add {String,Symbol}#casecmp?; CRuby2.4
2017-10-17 13:26:37 +09:00
ksss
19785f43d1
Reimplement String#upto
2017-06-14 17:30:31 +09:00
Yukihiro "Matz" Matsumoto
4763312fb8
Terminate loop if generated string longer than the last; ref #3489
2017-03-10 10:38:28 +09:00
ksss
eba4b1fd76
Check modifiable for String `bang' methods
2017-03-05 23:04:22 +09:00
Tomasz Dabrowski
ac9d04f4af
String#ljust and String#rjust reimplemented with optimized Ruby
2017-02-10 15:31:33 +01:00
Tomasz Dabrowski
981105b3e6
String#ljust and String#rjust reimplementation ( fix #3445 )
...
- 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-02-10 12:59:28 +01:00
ksss
eeca6ec8f5
Rewrite String#prepend with Ruby
...
Fix #3357
2017-01-04 14:00:28 +09:00
Yukihiro "Matz" Matsumoto
92be276d76
String#{strip,lstrip,rstrip} may cause OOB access
2016-11-17 18:00:21 +09:00
Nobuyoshi Nakada
6511bfd79a
Removed trailing spaces
2016-09-28 12:29:41 +09:00
Kouhei Sutou
6bb0775d76
Reduce needless Array generation in some String methods
...
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-27 13:58:07 +09:00
ksss
bef63a4f91
Support to call without block to String#each_char
2016-07-26 18:46:23 +09:00
ksss
d83d9cd164
String#insert should be destructive
2016-07-14 21:33:15 +09:00
Akira Moroo
e86bc6bb47
Add String#rjust to mruby-string-ext
2016-01-30 14:25:53 +09:00
takahashim
621487a0cd
add {Array|Hash|String}.try_convert
2015-11-24 08:39:39 +09:00
Yukihiro "Matz" Matsumoto
798ec3aff4
UTF-8 string support in core
...
define MRB_UTF8_STRING (in mrbconf.h) to enable UTF-8 support.
2015-09-24 02:37:33 +09:00
INOUE Yasuyuki
0d055559f1
Use #nil? instead of == nil.
2015-08-22 19:57:11 +09:00
Jun Hiroe
e998094297
Add String#upto
2015-01-13 16:32:30 +09:00
takahashim
1b606025ed
add String#ljust into mruby-string-ext
2015-01-12 22:16:29 +09:00
Jun Hiroe
45a442a9d7
Add String#insert
2014-12-13 15:31:22 +09:00
TOMITA Masahiro
0a0afa7c6a
Fix String#slice! raise TypeError or return invalid value.
2014-11-23 21:26:50 +09:00
Akito Mochizuki
ec04fa7e8d
Modify return value of String#slice! if idx == self.size
2014-06-19 17:34:17 +09:00
Jun Hiroe
00fa8097f9
Implement String#slice_bang
2014-06-15 21:11:54 +09:00
ksss
f1e15b0236
String#clear: use String#replace to simple
2014-06-11 14:46:52 +00:00
Yukihiro "Matz" Matsumoto
896c131231
Merge pull request #2346 from suzukaze/add-string-comment2
...
Fix indent in String#casecmp comments
2014-06-03 15:44:13 +09:00
Jun Hiroe
85ed19ca4d
Fix indent in String#casecmp comments
2014-06-02 22:03:29 +09:00
Jun Hiroe
cbe73e93f7
Add comments in String#lstrip, rstrip, strip, lstring_bang, rstrip_bang and strip_bang
2014-06-02 22:00:05 +09:00
ksss
617fa70211
String#casecmp should be call to_str
...
when non String object sent
And should be raise TypeError
when can not responsed to `to_str`
2014-04-20 13:25:07 +09:00
Tomoyuki Sahara
120a02c15d
add String#partition and String#rpartition.
2013-12-27 15:30:20 +09:00
h2so5
79e7bbc8e8
Add String#swapcase,swapcase!,concat,casecmp,start_with,end_with
2013-04-19 21:01:37 +09:00
Tomoyuki Sahara
11edea3880
add "strip" family to String.
2013-03-08 09:45:04 +09:00