Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
"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"
Stylistically, chomp has a bit more of the whimsy that you might expect from Ruby, while delete_suffix is a nice mirroring of delete_prefix and more explicitly named. Both have similar performance benchmarks and are faster than sub.