lto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:53 PM
To: David Gerler
Cc: Beginners
Subject: Re: Cut string between the words
On Jul 23, Jeff 'japhy' Pinyan said:
> if (length($str) > 85) {
>$str =~ s/(.{0,85})(?<=\S)(?!\S).*/$1/s;
> }
That can be
$str =~
Chesapeake VA 23328
http://www.GerlerEnterprises.com/
Nationwide Dial-up from $12.45
http://www.EasySitesForLess.com/
-Original Message-
From: Shawn [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:28 PM
To: David Gerler; Beginners
Subject: Re: Cut string between the words
Check
On Jul 23, Jeff 'japhy' Pinyan said:
> if (length($str) > 85) {
>$str =~ s/(.{0,85})(?<=\S)(?!\S).*/$1/s;
> }
That can be
$str =~ s/(.{0,84}\S)(?!\S).*/$1/s;
> use Regexp::Keep;
> $str =~ s/.{0,85}\K(?<=\S)(?!\S).*//s;
And that would be
$str =~ s/.{0,84}\S\K(?!\S).*//s;
The Rege
>I figure that I can use substr() to cut up a string, but how do I make it
>between words?
you can split the string on whitespace, for one.
my @array = split /\s+/, $string;
>How do I measure a string to see if it is greater than 85 characters?
my $string_len = length($string);
>Basically, if
On Jul 23, David Gerler said:
>How do I measure a string to see if it is greater than 85 characters?
Using length().
if (length($str) > 85) { ... }
>Basically, if the string is more than 85 characters, how do I break it at
>the last full word?
Well, it depends what you call a "word". Let's
David Gerler wrote:
>
> I figure that I can use substr() to cut up a string, but how do I make it
> between words?
>
> How do I measure a string to see if it is greater than 85 characters?
>
> Basically, if the string is more than 85 characters, how do I break it at
> the last full word?
$stri
Check out Text::Wrap on CPAN.
http://search.cpan.org/doc/MUIR/Text-Tabs+Wrap-2001.0131/lib/Text/Wrap.pm
Shawn
- Original Message -
From: "David Gerler" <[EMAIL PROTECTED]>
To: "Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 1:16 PM
Subject: Cut string between the words
>