summaryrefslogtreecommitdiff
path: root/sample/split.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/split.rb')
-rw-r--r--sample/split.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/sample/split.rb b/sample/split.rb
new file mode 100644
index 0000000000..737173635e
--- /dev/null
+++ b/sample/split.rb
@@ -0,0 +1,12 @@
+print("1 byte string", "\n")
+print("1 byte string".reverse, "\n")
+
+print("全角文字列", "\n")
+print("全角文字列".reverse, "\n")
+
+print("1 byte string", "\n")
+print("1 byte string".split(//).reverse.join(":"), "\n")
+print("全角文字列", "\n")
+print("全角文字列".split(//).reverse.join(":"), "\n")
+print("全角と1byteの混在", "\n")
+print("全角と1byteの混在".split(//).reverse.join(":"), "\n")