Yukihiro "Matz" Matsumoto
b5d43a16a3
Removed String#try_convert method from mruby-string-ext gem.
...
Because `try_convert` method rarely used in production. For mruby users,
we have `__to_str` utility method to check string type.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto
ff08856fe3
Remove implicit conversion using to_str method; fix #3854
...
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-11-19 12:05:46 +09:00
Yukihiro "Matz" Matsumoto
afca99a40b
Remove implicit conversion using to_int method.
...
The ISO standard does not include implicit type conversion using
`to_int`. This implicit conversion often causes vulnerability.
There will be no more attacks like #4120 .
In addition, we have added internal convenience method `__to_int` which
does type check and conversion (from floats).
2018-11-19 11:28:51 +09:00
Yukihiro "Matz" Matsumoto
f2084f300b
Add tests for empty patterns for tr and count; #4156 #4157
2018-11-02 08:58:21 +09:00
Yukihiro "Matz" Matsumoto
346f154ece
Implement String#delete and #delete!; ref #4086
...
mruby restriction:
In mruby, `String#delete` only takes single pattern argument.
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
58f7f2361a
Implement String#count; ref #4086
...
mruby restriction:
In mruby, `String#count` does not take multiple pattern arguments,
but only one pattern.
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
68523b4ec4
Add String#squeeze and #squeeze!; ref #4086
...
mruby restriction:
`String#squeeze` can take more than 1 pattern arguments in CRuby,
in that case, the intersection of patterns will be used to match.
But in mruby, it doesn't take multiple patterns.
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
c0ae8a96a1
Add String#tr_s and String#tr_s!; ref #4086
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
58ba38fe1e
Add String#tr and #tr! to mruby-string-ext gem; fix #4086
...
This patch is based on `mruby/c` implementation by Hirohito Higashi.
We might need to add `#tr_s`, `#squeeze` and `#delete` as well.
Adding them should not be too hard using functions we implemented here.
2018-09-21 00:03:07 +09:00
Yukihiro "Matz" Matsumoto
332d8d2a1c
Add String#delete_{prefix,suffix}; CRuby2.5
2017-10-17 11:19:12 +09:00
ksss
19785f43d1
Reimplement String#upto
2017-06-14 17:30:31 +09:00
ksss
98f9c33fe0
String#concat: Try to convert when not string
2017-05-21 10:30:27 +09:00
Yukihiro "Matz" Matsumoto
0b143898c4
Remove historical comment; ref #3450 #3448
2017-02-11 16:52:45 +09:00
robert
b130f43298
remove skip that shouldn't be necessary anymore.
...
the test should pass after https://github.com/mruby/mruby/commit/8f4a929e1a01c8d6176fb53a9ef5dff6de632959 .
2017-02-11 07:40:55 +00:00
Tomasz Dabrowski
24048cd998
Tests for UTF-8 String#ljust and String#rjust
2017-02-10 15:16:49 +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
Craig Lehmann
83005d83d8
Read length after args in String#setbyte
...
Prevents RCE
Reported by https://hackerone.com/raydot
2016-11-24 10:31:29 -05:00
Hiroshi Mimaki
861b0eed7b
Fix String#ord failure which return a negative value
2016-08-17 15:29:59 +09:00
ksss
d83d9cd164
String#insert should be destructive
2016-07-14 21:33:15 +09:00
Akira Moroo
cb1a80e741
Add String#rjust test to mruby-string-ext
2016-01-30 14:28:00 +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
Yukihiro "Matz" Matsumoto
4fdf492219
add String#setbyte and String#byteslice to mruby-string-ext
2015-08-05 11:28:41 +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
7ea38ce473
Add String#prepend
2014-12-17 02:23:36 +09:00
Jun Hiroe
45a442a9d7
Add String#insert
2014-12-13 15:31:22 +09:00
mattn
4ece1e3e29
"-a-a-".succ should be "-a-b-"
2014-08-11 15:00:44 +09:00
mattn
3103d063e2
Fix String#succ. "-a-".succ should be "-b-"
2014-08-11 14:28:05 +09:00
mattn
34f40b0a01
Fix String#succ. "-".succ should be "."
2014-08-11 14:01:10 +09:00
Yukihiro "Matz" Matsumoto
7a5d3c19c6
remove test for succ on Unicode (non-ASCII) char; #2520
2014-08-08 23:16:12 +09:00
mattn
dc0c354658
Add String#succ, String#succ!, String#next, String#next!
2014-08-08 17:58:07 +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
Yukihiro "Matz" Matsumoto
6459a98448
move String#clear to mruby-string-ext; ref #2370
2014-06-07 22:28:42 +09:00
Yukihiro "Matz" Matsumoto
76012a885d
remove UTF-8 strings from mruby-string-ext test
2014-06-07 22:23:25 +09:00
mattn
c927277486
Add String#lines
2014-06-04 10:41:07 +09:00
Jun Hiroe
e67817fcec
Implement String#chr
2014-06-03 19:49:38 +09:00
Nobuyoshi Nakada
ab67c57f65
remove trailing spaces
2014-04-30 09:50:14 +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
mattn
ea68fe2f15
More tests for String#hex, String#oct as against 9434506035
2014-03-31 09:47:21 +09:00
cubicdaiya
9c06f297ee
add String#oct
2014-03-27 14:10:08 +09:00
mattn
0df65751c6
Implement String#hex
2014-03-27 11:28:29 +09:00
Yukihiro "Matz" Matsumoto
dc25f85bab
mruby-string-utf8: UTF-8 string may contail NUL; #1646
2014-01-07 15:00:55 +09:00
Tomoyuki Sahara
120a02c15d
add String#partition and String#rpartition.
2013-12-27 15:30:20 +09:00
Tomoyuki Sahara
f77dc2e6cb
Merge branch 'mruby' into pr-typeerror-string-start-end-with
...
Conflicts:
mrbgems/mruby-string-ext/src/string.c
mrbgems/mruby-string-ext/test/string.rb
2013-08-26 23:20:22 +09:00
Yukihiro "Matz" Matsumoto
91b878e5df
Merge pull request #1485 from fjmilens3/string_end_with
...
Bug in String#end_with? resulting from incorrect length determination
2013-08-26 04:17:20 -07:00
Tomoyuki Sahara
0e8efd4a21
Check type of arguments for #start_with and #end_with.
2013-08-23 15:06:26 +09:00
Frederick John Milens III
d42427870b
Added test case for String#end_with? with string of length 2.
2013-08-22 18:41:23 -05:00
Frederick John Milens III
de5f5732fe
Added test case for String#start_with? with string of length 1.
2013-08-22 16:37:42 -05:00