HASUMI Hitoshi
03a426ec8d
[Feature #22279 ] Add region arguments to String bit operations ( #18562 )
...
This patch extends the following String methods:
* String#bit_set(offset, length, lsb_first: true) -> self
* String#bit_set(range, lsb_first: true) -> self
* String#bit_clear(offset, length, lsb_first: true) -> self
* String#bit_clear(range, lsb_first: true) -> self
* String#bit_flip(offset, length, lsb_first: true) -> self
* String#bit_flip(range, lsb_first: true) -> self
* String#bit_count(offset, length, lsb_first: true) -> Integer
* String#bit_count(range, lsb_first: true) -> Integer
Link: [Feature #22279 ]
2026-09-14 17:30:15 +09:00
Peter Zhu
2423f69df4
[DOC] Fix extra word in string/inspect.rdoc
2026-08-14 07:05:24 +09:00
HASUMI Hitoshi
2461caebba
[Feature #22118 ] Introduce Basic Bit Operations into String ( #17353 )
...
This patch adds the following methods to String class:
* String#bit_get(offset, lsb_first: true) -> 1 | 0 | nil
* String#bit_set?(offset, lsb_first: true) -> true | false | nil
* String#bit_set(offset, lsb_first: true) -> self
* String#bit_clear(offset, lsb_first: true) -> self
* String#bit_flip(offset, lsb_first: true) -> self
* String#bit_count -> Integer
* String#bitwise_not -> String
* String#bitwise_not! -> self
* String#bitwise_and(other) -> String
* String#bitwise_and!(other) -> self
* String#bitwise_or(other) -> String
* String#bitwise_or!(other) -> self
* String#bitwise_xor(other) -> String
* String#bitwise_xor!(other) -> self
Other than implementation, tests, specs, and docs are added.
Link: [Feature #22118 ]
## Note
In `string.c`, I wrote some big macro that create method functions and helper
functions:
* STR_DEFINE_BINARY_BITWISE_METHOD
* STR_DEFINE_UNARY_BITWISE_KERNEL
* STR_DEFINE_BINARY_BITWISE_KERNEL
While using macros like this reduces maintainability, I believe it's acceptable
because there are no plans to extend the `bitwise_*` methods beyond this
proposal, and the logic is stable.
On the other hand, other methods such as `bit_get` and `bit_count` are planned to
have argument extensions in the future.
2026-08-06 21:40:37 +09:00
Peter Zhu
f91aad6cc6
[DOC] Fix output of example in String encoding
2026-08-03 09:01:32 -04:00
Peter Zhu
6e3fcfa342
[DOC] Fix missing quote in String#aset
2026-06-17 22:24:14 +09:00
Peter Zhu
09847a62a3
[DOC] Fix String#split docs
...
When `limit` is negative, the trailing empty strings are included.
2026-06-16 10:09:24 +09:00
Jack Bowlin
8a12816b00
[DOC] Fix typos in String#dump and String#bytesplice docs
2026-05-31 08:20:50 +09:00
BurdetteLamar
f8eed58469
[DOC] Fix links in String
2026-02-06 18:35:02 -05:00
Nelli Simkova
3328246b91
[DOC] Fix typo in String#scrub doc
2026-01-24 12:38:15 +09:00
Burdette Lamar
5230f835e8
[DOC] Harmonize #[] methods
2026-01-07 18:01:56 -05:00
BurdetteLamar
a92c0342dd
[DOC] Japanese only for multi-byte chars examples
2025-12-27 10:59:48 -05:00
BurdetteLamar
38d24294ac
[DOC] Multibyte chars Japanese only
2025-12-27 10:59:23 -05:00
Nobuyoshi Nakada
b908306f99
[DOC] Reword "Regular Expression" to "Matched Data"
...
`$~` and its accessors are related to regular expressions, but are not
themselves.
2025-12-25 11:49:32 +09:00
Nobuyoshi Nakada
688c1f6c5e
[DOC] Reword "Pattern Matching" to "Regular Expression"
...
In ruby, since 3.1 at least, the words "Pattern Matching" should refer
the syntax.
2025-12-24 10:46:58 +09:00
BurdetteLamar
99b915944f
[DOC] Russian strings should look Russian
2025-12-18 17:47:18 -05:00
Peter Zhu
fb80f84fc7
[DOC] Fix formatting in docs for String#[]=
2025-12-06 17:59:50 -08:00
BurdetteLamar
bd64cf00a2
[DOC] Tweaks for String#capitalize
2025-12-05 19:05:55 -08:00
BurdetteLamar
2491a504ff
[DOC] Tweaks for String#downcase
2025-12-05 19:05:18 -08:00
BurdetteLamar
e5e4175dbd
[DOC] Tweaks for String#upcase
2025-12-05 19:04:59 -08:00
BurdetteLamar
da2c67388a
[DOC] Tweaks for String#swapcase
2025-12-05 19:04:23 -08:00
BurdetteLamar
bbef73b2ff
[DOC] Better multibyte-character data
2025-12-05 19:03:22 -08:00
Stan Lo
4cd6661e18
Reorganize page documentations ( #15154 )
...
Re-organize page docs
2025-11-27 20:12:24 +00:00
Burdette Lamar
d5368fc515
[DOC] Tweaks for String#valid_encoding?
2025-11-20 17:07:44 -05:00
BurdetteLamar
d1b11592af
[DOC] Tweaks for String#upto
2025-11-20 14:06:16 -08:00
Burdette Lamar
59e0489248
[DOC] Tweaks for String#upcase ( #15244 )
2025-11-20 17:03:58 -05:00
BurdetteLamar
1443f89d69
[DOC] Tweaks for String#unicode_normalize
2025-11-18 18:57:29 -08:00
Burdette Lamar
319001192d
[DOC] Tweaks for String#dump and String#undump
2025-11-18 21:56:14 -05:00
BurdetteLamar
836fc00e19
[DOC] Tweaks for String#swapcase
2025-10-27 21:19:42 -04:00
BurdetteLamar
bf2663ce06
[DOC] Tweaks for String#sum
2025-10-27 21:14:54 -04:00
Burdette Lamar
5c683bd9b3
[DOC] Tweaks for String#succ
2025-10-26 15:04:16 -04:00
BurdetteLamar
245df86ec3
[DOC] Tweaks for String#sub
2025-10-24 18:09:32 -04:00
BurdetteLamar
8b0d405337
[DOC] Tweaks for String#start_with?
2025-10-23 18:12:42 -04:00
BurdetteLamar
d4ea1686b5
[DOC] Tweaks for String#split
2025-10-22 18:13:58 -04:00
BurdetteLamar
f9338a95af
[DOC] Tweaks for String#squeeze
2025-10-22 18:04:20 -04:00
Burdette Lamar
cb52809ca1
[DOC] Tweaks for String#scrub ( #14892 )
2025-10-21 16:48:11 -04:00
Burdette Lamar
42c0409781
[DOC] Tweaks for String#scan ( #14884 )
2025-10-21 16:44:41 -04:00
BurdetteLamar
3b87e76cc6
[DOC] Tweaks for String#rpartition
2025-10-20 21:38:18 -04:00
Burdette Lamar
9b2216954a
[DOC] Tweaks for String#rindex
2025-10-17 20:40:58 -04:00
Peter Zhu
df5d63cfa2
[DOC] Fix typo in String#partition
2025-10-14 18:26:08 -04:00
BurdetteLamar
25821f3438
[DOC] Tweaks for String#rjust
2025-10-13 18:14:57 -04:00
BurdetteLamar
53ca9fbb4c
[DOC] Tweaks for String#rjust
2025-10-13 18:14:57 -04:00
Burdette Lamar
0090311db2
[DOC] String slices doc ( #14740 )
2025-10-10 16:39:05 -04:00
Burdette Lamar
8ce886b2d8
[DOC] Tweaks for String#partition
2025-09-30 12:02:27 -04:00
BurdetteLamar
5f56a7f9bb
[DOC] Tweaks for String#ord
2025-09-20 19:59:40 -04:00
BurdetteLamar
d2ef901f6c
[DOC] Tweaks for String#length
2025-08-27 09:25:36 -04:00
Burdette Lamar
6a2964d28c
[DOC] Tweaks for String#intern ( #14314 )
2025-08-26 14:27:54 -04:00
Burdette Lamar
dbfd0973d3
[DOC] Tweaks for String#inspect
2025-08-26 14:27:42 -04:00
Burdette Lamar
bb9116281b
[DOC] Tweaks for String#ljust
2025-08-26 14:23:33 -04:00
BurdetteLamar
6fbe2dd36e
[DOC] Tweaks for String#insert
2025-08-21 18:52:15 -04:00
Burdette Lamar
027f4aa464
[DOC] Tweaks for String#hash ( #14253 )
2025-08-21 09:37:19 -04:00