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 C39681AE022E for ; Wed, 7 Sep 2016 15:09:36 +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 BCC16B5D9B4 for ; Wed, 7 Sep 2016 15:42:10 +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 5E06E18CC7ED for ; Wed, 7 Sep 2016 15:42:11 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 8A80912049E; Wed, 7 Sep 2016 15:42:11 +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 2720912049A for ; Wed, 7 Sep 2016 15:42:06 +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=lc0J2LMzNx0Kdg3K+gsN0dCj6iA=; b=d9aTXS7+vCz6kNNQUe IkvpJwYgQBwHMd7zDrqC9Zmt4b6M7Cn3tqxwzJxWaa73TXwI+gciF+1ecfPGbnMd f+0OanWqeqE3+PlAvMTDc1jz0R8nR9pNkeimywJr4P+ZKay9mcpODb0GqebYAjsN rGCIjL5Ody0TQNRKBQFs0HU/A= Received: by filter0931p1mdw1.sendgrid.net with SMTP id filter0931p1mdw1.24735.57CFB6BB4 2016-09-07 06:42:03.074902517 +0000 UTC Received: from herokuapp.com (ec2-54-204-80-184.compute-1.amazonaws.com [54.204.80.184]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id WuZsQ7bnRq23SCCLmSWHog for ; Wed, 07 Sep 2016 06:42:03.092 +0000 (UTC) Date: Wed, 07 Sep 2016 06:42:03 +0000 From: muraken@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 51969 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 12694 X-Redmine-Issue-Author: sonots X-Redmine-Sender: mrkn 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS4WcP1xrYEDyMcI3lHrCJqkq3Yk7VwJD1K9go EgG0P5vnvxVsbRmFe/jS6YSvwhM1TzvfbfJpVa37W0yj3gCnYHyNyX8JxBhui/ZORWYUoLzua+Rq9c c28xyzjz7ZxUTuuwlOYhVKuTp+hFwNVXCi00 X-ML-Name: ruby-core X-Mail-Count: 77175 Subject: [ruby-core:77175] [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 Kenta Murata. This method removes prefix string, so I propose `remove_prefix` or `deprefix` (means remove prefix). ---------------------------------------- Feature #12694: Want a String method to remove heading substr https://bugs.ruby-lang.org/issues/12694#change-60389 * 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/