String#delete_prefix and String#delete_suffix are super readable

This page summarizes the projects mentioned and recommended in the original post on /r/ruby

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • Ruby on Rails

    Ruby on Rails

  • "BoringRails!".delete_prefix("Boring") #=> "Rails!" "#programming".delete_prefix("#") #=> "programming" "ISBN: 9780091929787".delete_prefix("ISBN: ") #=> "9780091929787" "mailto:[email protected]".delete_prefix("mailto:") #=> "[email protected]" github_url = "https://github.com/rails/rails" repo_name = github_url.delete_prefix("https://github.com/") #=> "rails/rails" "report.csv".delete_suffix(".csv") #=> "report" "150 cm".delete_suffix("cm").to_i #=> 150

  • Puts Debuggerer

    Ruby library for improved puts debugging, automatically displaying bonus useful information such as source line number and source code.

  • "BoringRails!".delete_prefix("Boring") #=> "Rails!" "#programming".delete_prefix("#") #=> "programming" "ISBN: 9780091929787".delete_prefix("ISBN: ") #=> "9780091929787" "mailto:[email protected]".delete_prefix("mailto:") #=> "[email protected]" github_url = "https://github.com/rails/rails" repo_name = github_url.delete_prefix("https://github.com/") #=> "rails/rails" "report.csv".delete_suffix(".csv") #=> "report" "150 cm".delete_suffix("cm").to_i #=> 150

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts