Re: Counting the # of characters in a multi-line string



mike.wilson8@xxxxxxxxxxx wrote:
My next goal is to count the total nunber of characters in a string

perldoc -q count

How can I count the number of occurrences of a substring
within a string?

and the number of chomps that I did.

my $number_of_chomps = chomp;

but chomp only removes characters at the end of a string (or at the end
of all strings in an array). It won't remove newlines embedded within
a string (use /s\n//g).

--
David Filmer (http://DavidFilmer.com)

.



Relevant Pages

  • Re: How does this work?
    ... Let's say the string value is ... The value of the first argument is the substring that matched. ... the match extends as long as the delimiter characters don't match. ... So, as you can probably see now, it is actually a simple template engine ...
    (comp.lang.javascript)
  • Re: Prothon should not borrow Python strings!
    ... """It does not make sense to have a string without knowing what encoding ... same cul de sac as Python. ... Prothon_String_As_ASCII // raises error if there are high characters ... Python's split between byte strings and Unicode strings is ...
    (comp.lang.python)
  • Re: "Reversed" LCS problem
    ... have to worry so much about defining "substring" versus "subsequence," ... say "the letters in the string must be next to each other, ... >> has the lowest number of common characters from the other strings, ... > No whitespaces, no sequences, only substrings. ...
    (comp.programming)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... put them in stupid places. ... Programming is difficult (as you must surely appreciate, ... > strings will be in the range 1...1000 characters. ... impose an artificially small limit on string length." ...
    (comp.programming)
  • Re: Deleting substrings
    ... substring is present in the string or not. ... We start at the beginning of the string. ... We copy the characters from the point immediately after ... redundant scans of the host string. ...
    (comp.programming)