From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 78B771AC01D1 for ; Tue, 23 Aug 2016 20:28:55 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 05D91B5D8BC for ; Tue, 23 Aug 2016 21:01:56 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id CACA718CC7B1 for ; Tue, 23 Aug 2016 21:01:56 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 17E2E120439; Tue, 23 Aug 2016 21:01:56 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 2F8AA12040B for ; Tue, 23 Aug 2016 21:01:51 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=/4+bgvHoxqr3dvSR8H4vU+a4RyU=; b=dkbjUYGkCy0q5ozda5 qolssDY69OvOqByoPZ6dScZCL7JbnIPeVwP+PnMdFVyxi19zW6n6p27oIyToKsB7 ukBz5J//cyjAaidI1UEohWhsuZZQEA/Avdq1MlIhF51nDi/L7oqjHJZIUMnRVFwz ccg6HhZ7dB+n1LojxLeNJ2sbU= Received: by filter0642p1mdw1.sendgrid.net with SMTP id filter0642p1mdw1.22487.57BC3B2769 2016-08-23 12:01:43.613490033 +0000 UTC Received: from herokuapp.com (ec2-54-147-153-223.compute-1.amazonaws.com [54.147.153.223]) by ismtpd0002p1iad1.sendgrid.net (SG) with ESMTP id 5TZQjFXMQdGq33dpe5ZBgA for ; Tue, 23 Aug 2016 12:01:43.460 +0000 (UTC) Date: Tue, 23 Aug 2016 12:01:43 +0000 From: sonots@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 51811 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 12694 X-Redmine-Issue-Author: sonots X-Redmine-Sender: sonots X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5jHGDt1l5NJurYVZD7pD1vyt92Tsyi72p+rW s+hOEWk2DRWcbz0DmhwaW3muX5+uP3IFt+L2lJX23cQad/cm6ZgiXbA3bRCwAOyt0LnY6s1ZrrChq7 dFNrpECXc799qbxpcb8tWRCvPSgYr95SlRm/ X-ML-Name: ruby-core X-Mail-Count: 77021 Subject: [ruby-core:77021] [Ruby trunk Feature#12694] Want a String method to remove heading substr X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #12694 has been updated by Naotoshi Seo. Thanks, I found an issue which is 3 years old https://bugs.ruby-lang.org/issues/6842 ---------------------------------------- Feature #12694: Want a String method to remove heading substr https://bugs.ruby-lang.org/issues/12694#change-60248 * Author: Naotoshi Seo * Status: Open * Priority: Normal * Assignee: ---------------------------------------- I often write codes like: ```ruby str = 'abcdef' substr = 'abc' str[substr.size..-1] if str.index(substr) == 0 #=> 'def' # or str.sub(/^#{substr}/, '') #=> 'def' ``` I want a short hand which is something like: ```ruby str = 'abcdef' substr = 'abc' str.rstrip(substr) #=> 'def' ``` Having similar argument for `String#lstrip` would be nice for symmetry although we already have `String#chomp(substr)` -- https://bugs.ruby-lang.org/