String question
am 01.07.2005 22:26:06 von GeekXHow to select substring:
from: "abcde *:; fghijkl mno pqrstuwxyz"
I want: everything between and icluding "cde" and "stu".
That is: "cde *:; fghijkl mno pqrstu"
Thanks!
How to select substring:
from: "abcde *:; fghijkl mno pqrstuwxyz"
I want: everything between and icluding "cde" and "stu".
That is: "cde *:; fghijkl mno pqrstu"
Thanks!
GeekX wrote:
> How to select substring:
>
> from: "abcde *:; fghijkl mno pqrstuwxyz"
>
> I want: everything between and icluding "cde" and "stu".
> That is: "cde *:; fghijkl mno pqrstu"
perldoc -f substr
perldoc -f index
> Thanks!
You're welcome.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
GeekX wrote:
> How to select substring?
Do not multi-post!!
http://www.uwasa.fi/~ts/http/crospost.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
In article
> How to select substring:
>
> from: "abcde *:; fghijkl mno pqrstuwxyz"
>
> I want: everything between and icluding "cde" and "stu".
> That is: "cde *:; fghijkl mno pqrstu"
Easiest way would be (untested):
my $substring;
my $string = 'abcde *:; fghijkl mno pqrstuwxyz';
if( $string =~ /(cde.*stu)/ ) {
$substring = $1;
}
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
# In any case the string is not identical to the
# number 0 so for me this is a bug.
print 'Bug !' if 'bug' == 0;
On 2005-07-04, George Bouras
> # In any case the string is not identical to the
> # number 0 so for me this is a bug.
>
> print 'Bug !' if 'bug' == 0;
No, it's not a bug, it's just the consequence of using a numeric
comparison on a string that doesn't begin with a digit.
I'm not sure where it is in the docs, but the camel has this:
""Improper conversions of a nonnumeric string like foo to a
number count as numeric 0; these trigger warnings if you have
them enabled, but are silent otherwise."
Essentially, it's just a result of the way converting a string to a
number is defined.
dha
--
David H. Adler -
"I'll keep him as an insurance policy, since, unfortunately, I can't
kill him twice." - Scaroth