From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: String variable composed of a repeat character Date: Sat, 08 May 2021 16:20:45 +0200 Message-ID: <87y2cps3oy.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37579"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.5.13; emacs 28.0.50 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 08 16:25:51 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lfNtu-0009eC-UW for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 08 May 2021 16:25:50 +0200 Original-Received: from localhost ([::1]:51590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfNtt-0003d3-9n for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 08 May 2021 10:25:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfNtP-0003cv-FI for help-gnu-emacs@gnu.org; Sat, 08 May 2021 10:25:19 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34712) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfNtP-0007bd-7m for help-gnu-emacs@gnu.org; Sat, 08 May 2021 10:25:19 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:53385) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfNtO-0005AD-SQ for help-gnu-emacs@gnu.org; Sat, 08 May 2021 10:25:18 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id A758127C0054 for ; Sat, 8 May 2021 10:25:18 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 08 May 2021 10:25:18 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeggedgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpehffgfhvffuffgjkfggtgesthdtre dttdertdenucfhrhhomhepvfgrshhsihhlohcujfhorhhnuceothhsughhsehgnhhurdho rhhgqeenucggtffrrghtthgvrhhnpeevveeikeetkeeviefgfeffiedvteeguddvffeuue duveegtddthedvhfeuveffhfenucfkphepkeejrdduieefrdefuddrudehgeenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnodhmvg hsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedvleek qdhtshguhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Original-Received: from thinkpad-t440p (p57a31f9a.dip0.t-ipconnect.de [87.163.31.154]) by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 8 May 2021 10:25:18 -0400 (EDT) In-reply-to: X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129566 Archived-At: pauline-galea@gmx.com writes: > How can a construct a string variable composed of repeating a > character n times? One way to do it (which works for both repeating a character or a string): --8<---------------cut here---------------start------------->8--- (defun foo/repeat-string (n str) (with-temp-buffer (dotimes (_ n) (insert str)) (buffer-string))) --8<---------------cut here---------------end--------------->8--- Bye, Tassilo