🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #49849

Re: newbie: łatwe: zliczanie wystąpień znaku w stringu

#49849
From: Paweł Piskorz
Date: Thu, 25 Feb 2010 12:21
6 lines
1296 bytes
On 2010-02-25 12:12, jivanmuktaWYTNIJTO@poczta.onet.pl wrote:
> Uczę się JS i mam taki problem:
> jak najprościej zliczyć w stringu wszystkie wystąpienia znaku "\n"? Czy da się
> bez pisania pętle? Nie mogę znaleźć odpowiedniej funkcji.

string.split( "\n" ).length-1
Technical Details
Message-ID: <hm5q0q$ddb$1@inews.gazeta.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
References: <4c17.0000009b.4b865b2c@newsgate.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
From: Paweł Piskorz <nie.ma.maila@psikre.nie?>
Newsgroups: pl.comp.lang.javascript
Subject: Re: newbie: łatwe: zliczanie
 wystąpień  znaku w stringu
Date: Thu, 25 Feb 2010 13:21:41 +0100
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 6
Message-ID: <hm5q0q$ddb$1@inews.gazeta.pl>
References: <4c17.0000009b.4b865b2c@newsgate.onet.pl>
NNTP-Posting-Host: 77-253-167-242.adsl.inetia.pl
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1267100506 13739 77.253.167.242 (25 Feb 2010 12:21:46 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Thu, 25 Feb 2010 12:21:46 +0000 (UTC)
X-User: uhorek
In-Reply-To: <4c17.0000009b.4b865b2c@newsgate.onet.pl>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 Hamster/2.1.0.11
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit