wouldn't it be easier and more efficient to simply
count the number of spaces in the string (and add 1)?
using substr_count or something similar
olinux
--- Justin French <[EMAIL PROTECTED]> wrote:
> You need to look at a few options... one is regular
> expression (not my
> forte), or perhaps w
rray functions to do whatever else you need to do - counting, positions,
etc
Debbie
- Original Message -
From: "Justin French" <[EMAIL PROTECTED]>
To: "Richard Kurth" <[EMAIL PROTECTED]>; "php-general"
<[EMAIL PROTECTED]>
Sent: Saturday, Sept
You need to look at a few options... one is regular expression (not my
forte), or perhaps winding through the string one character at a time,
writing a very simple state engine.
Justin French
on 28/09/02 4:47 PM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
> Hello Justin,
>
> That worked per
Hello Justin,
That worked perfect but I have one more problem I need to know if one
of the word is UNAVAILABLE I need to know if it is the first one or
the second one. I don't know if there is any way to do this.
1st 2nd
$string ="UNAVAILABLE AVAILABLE More Info";
if this is your SPECIFIC problem, putting a space at the beginning of $srch
will help, eliminating XAVAILABLE... but this will cause a problem with the
word AVAILABLE appearing at the start of the string, so temporarily put a
space at the start of the string:
this won't help if there are newlin
I need to count how many times the word AVAILABLE appears in a string
like this
$string ="AVAILABLE More Info AVAILABLE More Info";
some time the string looks like this
$string ="UNAVAILABLE More Info AVAILABLE More Info";
or
$string ="AVAILABLE More Info UNAVAILABLE More Info";
when I use
$src
Greg Donald wrote:
>
> > I want to check a string and return the amount of words present
> > in it. These
> > strings could be quite large, some higher than 100,000
> > characters. I realize
> > I could explode the string on the whitespace and count the number
> > of values.
> > However, I'm no
> I want to check a string and return the amount of words present
> in it. These
> strings could be quite large, some higher than 100,000
> characters. I realize
> I could explode the string on the whitespace and count the number
> of values.
> However, I'm not sure this would be the most opti
Hi,
I want to check a string and return the amount of words present in it. These
strings could be quite large, some higher than 100,000 characters. I realize
I could explode the string on the whitespace and count the number of values.
However, I'm not sure this would be the most optimized way to
9 matches
Mail list logo