⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 03 - reversing a string by words or characters.rb

📁 O Reilly Ruby Cookbook source code
💻 RB
字号:
s = ".sdrawkcab si gnirts sihT"s.reverse                             # => "This string is backwards."s                                     # => ".sdrawkcab si gnirts sihT"s.reverse!                            # => "This string is backwards."s                                     # => "This string is backwards."#---s = "order. wrong the in are words These"s.split(/(\s+)/).reverse!.join('')   # => "These words are in the wrong order."s.split(/\b/).reverse!.join('')      # => "These words are in the wrong. order"#---"Three little  words".split(/\s+/)   # => ["Three", "little", "words"]"Three little  words".split(/(\s+)/) # => ["Three", " ", "little", "  ", "words"]#---

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -