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 2391B1AC01D1 for ; Tue, 23 Aug 2016 17:34:01 +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 2367EB5D847 for ; Tue, 23 Aug 2016 18:07:02 +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 B61E818CC81F for ; Tue, 23 Aug 2016 18:07:02 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 2C1BB120450; Tue, 23 Aug 2016 18:07:02 +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 515B5120038 for ; Tue, 23 Aug 2016 18:06:58 +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=s1AGCBvoJnDU2VeB0fi0Wjmc3Sw=; b=OMuow0by5VpjSVuk/5 aS+dNQxMe3gXCfRweZzCpIr5H1mDcXaTsEvaqYzL3VFd62ryJt4MFq5RutI6J9BG cpzM6IsIBGkUhliJsywZyu0tOLvnuF/dlM3FC0i7cs806I9/jQwZTv4LNwTWYTg+ 3XBlgNGkCXQExibwLm/1w0SKM= Received: by filter0983p1mdw1.sendgrid.net with SMTP id filter0983p1mdw1.19939.57BC122C35 2016-08-23 09:06:52.846782277 +0000 UTC Received: from herokuapp.com (ec2-54-147-153-223.compute-1.amazonaws.com [54.147.153.223]) by ismtpd0003p1iad1.sendgrid.net (SG) with ESMTP id 3_DsRcs5QDaGoz2c9UmrSg for ; Tue, 23 Aug 2016 09:06:52.901 +0000 (UTC) Date: Tue, 23 Aug 2016 09:06:52 +0000 From: sonots@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 51807 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS4jJTHpS0GMyF2HgU8er3M+gxvp/IgXnqCke4 JYMkMnKjnh3AQ9J0yPhrFLqR5UhD+RVMZIML5HnrChbE2bXQ+WtH3Gh63WqyUit64e3rPlBCI7pnzh xCWxUezuV+vDlow0RtOtQFxFASNeAb2Mvg0g X-ML-Name: ruby-core X-Mail-Count: 77017 Subject: [ruby-core:77017] [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. Oops, lstrip and rstrip are opposite... Correctly, as below... ``` str = 'abcdef' substr = 'abc' str.lstrip(substr) #=> 'def' ``` Having similar argument for `String#rstrip` would be nice for symmetry although we already have `String#chomp(substr)` ---------------------------------------- Feature #12694: Want a String method to remove heading substr https://bugs.ruby-lang.org/issues/12694#change-60245 * 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/