473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Alternative for strripos

Hi there,

I'm trying to filter a big string.
For that, i need the opposite of strpos.
Strrpos doesn't work with strings as 'needle',
i found strripos does accept strings as 'needle',
but that's only from PHP 5. I only have Version 4.3.11.

Any clues out there?

Thanks. Frizzle.

Dec 28 '05 #1
2 1961
frizzle said the following on 28/12/2005 20:53:
Hi there,

I'm trying to filter a big string.
For that, i need the opposite of strpos.
Strrpos doesn't work with strings as 'needle',
i found strripos does accept strings as 'needle',
but that's only from PHP 5. I only have Version 4.3.11.

Any clues out there?


I guess you could reverse your needle and haystack (strrev()), convert
them both to lower-case (strtoupper()), use a case-sensitive forward
search (strpos()), and then convert the return value with some simple
maths and strlen().

A bit long-winded and inefficient, but should do the job.

--
Oli
Dec 28 '05 #2
Oli Filth wrote:
frizzle said the following on 28/12/2005 20:53:
Hi there,

I'm trying to filter a big string.
For that, i need the opposite of strpos.
Strrpos doesn't work with strings as 'needle',
i found strripos does accept strings as 'needle',
but that's only from PHP 5. I only have Version 4.3.11.

Any clues out there?


I guess you could reverse your needle and haystack (strrev()), convert
them both to lower-case (strtoupper()), use a case-sensitive forward
search (strpos()), and then convert the return value with some simple
maths and strlen().

A bit long-winded and inefficient, but should do the job.

--
Oli


Ok, i get what you mean, i sort of thought of this myself, but i was
hoping there would be a better solution.

My final goal is to copy content of a soccer-webpage, filter it, and
come up with the current score of all the teams.
The scheme is at
http://www.knvb.nl/clubs_comp/?actio...mDescription=1

The regarding scheme is the one with "Stand" in the bright orange beam.
What i need is to find 12 appearances of teams from the DB after each
other (in every next line) and then break the lines up into an array
with 10 items in it ...

I hope this makes sense ...

Frizzle.
I have all the teams in the current competition in my DB.

Dec 28 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
by: Robin Becker | last post by:
It seems that the rotor module is being deprecated in 2.3, but there doesn't seem to be an obvious alternative. I'm using it just for obfuscation. It seems we have ssl available in 2.3 for sockets,...
99
by: Paul McGuire | last post by:
There are a number of messages on the python-dev mail list that indicate that Guido is looking for some concensus to come from this list as to what *one* alternative syntax for decorators we would...
28
by: Paul McGuire | last post by:
Well, after 3 days of open polling, the number of additional votes have dropped off pretty dramatically. Here are the results so far: Total voters: 55 (with 3 votes each) Votes for each choice...
1
by: Bob Smith | last post by:
so is there any alternative ( standard only ) to using in_avail()? I need to poll with given intervals the input stream, and if there is data to be read I want to read it. thank you /B
43
by: Dimitri Debruyne | last post by:
Hi group I am in the process of developing a website in XHTML Strict and CSS. Is there a way to open a link in a new window without the use of frames or Javascript or something ? I didn't find a...
1
by: prasaddevivara | last post by:
I am using the outerHTML property to modify the HTML of existin elements in a web page in Internet Explorer. But same outerHTM property is not working in firefox browser, Anybody can tell me a...
3
by: Will McGugan | last post by:
Hi, Is there a naming convention regarding alternative constructors? ie static methods where __new__ is called explicity. I use lower_case for methods in general, but thought maybe CamelCase...
0
by: sachintandon | last post by:
Hello all, Thanks in advance for your help I have a problem in sending emails, my requirement is to send multipart alternative emails with attachments, I'm able to send text with attachments or...
11
by: Francine.Neary | last post by:
I've read that as well as "normal" Java-like function definitions, e.g. int main(int argc, char **argv), you can also choose to use an alternative syntax, i.e. int main(argc, argv) int argc;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.