Breaking Down the Split

A comprehensive guide to Ruby’s split method

Waverley Leung
The Startup

--

Photo by Chris Ried on Unsplash

Table of Contents

  1. Introduction
  2. Vocabulary Review
  3. So… what is the split method exactly?
  4. What can I do with the split method?
    4a. Split with NO pattern and/or limit
    4b. Split with ONLY pattern
    4c. Split with pattern AND limit
    4d. Something to put out there…
  5. Conclusion & Takeaways
  6. Want more? Other resources to check out!

Introduction

(Don’t have time? Skip to the next section for the good stuff!)

As someone who has a little more than nine weeks of learning and experience with coding, I am very grateful that Ruby is my first programming language. Although I don’t know much about other programming languages to compare, there is so much that I appreciate about Ruby. For example, Ruby has built-in methods that make my life easier…

…actually that’s not entirely true. Because Ruby has so many methods to make life easier, it’s hard to remember them all (not to mention how to use them). Thankfully, you can always check the documentation so you don’t have to!

One of the more powerful methods at our disposal is split because of its ability to…

--

--

Waverley Leung
The Startup

“Be present. Be open. Be kind. But speak your mind.” 🌱 Passionate about tech, connecting with people, eating good food, and dancing to my heart’s content.