Hi, I wonder if anyone can help?
How do I see if one string is found within another string?
or how many instances of one string, is found within another.
ie.
a="Sheree smells of poo"
b="smells"
I'd like a function that would return 1, (for true, or that the word
smells, if found once)
PHP is ace. There must be a simple way of doing this. I mean, its got
loads of useless functions that noones ever going to use. Im sure if
PHP has a built-in function to convert hebrew, then Im sure it can do
this. Any ideas?
Cheers
Phil. 4 1564 go**********@bu dget-edi.co.uk wrote: Hi, I wonder if anyone can help?
How do I see if one string is found within another string? or how many instances of one string, is found within another.
ie.
a="Sheree smells of poo" b="smells"
I'd like a function that would return 1, (for true, or that the word smells, if found once)
PHP is ace. There must be a simple way of doing this. I mean, its got loads of useless functions that noones ever going to use. Im sure if PHP has a built-in function to convert hebrew, then Im sure it can do this. Any ideas?
Cheers Phil.
Phil, http://www.php.net/manual/en/function.strpos.php
Carl.
I noticed that Message-ID:
<5D************ ***@newssvr19.n ews.prodigy.com > from Carl contained the
following: a="Sheree smells of poo" b="smells"
http://www.php.net/manual/en/function.strpos.php
But be careful of the comparison you do. If the search string is at the
beginning strpos will return 0, naturally. You want anything other than
false so you need to do !==false as the comparison.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
On Fri, 12 Aug 2005 17:45:37 -0700, googlegroups wrote: How do I see if one string is found within another string? or how many instances of one string, is found within another.
strstr(),preg_m atch()
-- http://www.mgogala.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Danny |
last post by:
HI again
Is there a nifty function in access that will:
1. return the amount of occurances of a small string within a larger
string?
this<br>is<br>a<br>test
would return 3 for <br>
|
by: tshad |
last post by:
Can you do a search for more that one string in another string?
Something like:
someString.IndexOf("something1","something2","something3",0)
or would you have to do something like:
if ((someString.IndexOf("something1",0) >= 0) ||
((someString.IndexOf("something2",0) >= 0) ||
|
by: Tom |
last post by:
Is there such a thing as a CONTAINS for a string variable in VB.NET? For
instance, I want to do something like the following:
If strTest Contains ("A","B", "C") Then
Debug.WriteLine("Found characters")
Else
Debug.WriteLine("Did NOT find characters!")
End If
|
by: Badass Scotsman |
last post by:
Hello,
Using VB and ASP,NET I would like to be able to search a STRING for a
smaller STRING within, based on the characters which appear before and
after.
For example:
String1 = " That was a tasty burger"
|
by: tommaso.gastaldi |
last post by:
I have a file containing some commands in free format. Each
command is terminated with ";". The ";" can also be found within the
command but, only enclosed within delimiters (' or ""). Example:
INSERT INTO nation (code, name) VALUES(700448768,
"za; sdfhsd''"sdfa");
INSERT INTO nation (code, name)
VALUES(701464576, 'msd; vasdvas ""hjh"" u');
| |
by: Dana King |
last post by:
I'm looking for some other developers opinions, I'm trying to find the best
way to count strings within a string using VB.net.
I have tested five methods and have found the String.Replace method is the
fastest and the Regex.Matches.Count to be the slowest. I posted my results
and source code to my web site. If you could take a look and maybe suggest
an even faster method I'd like to hear from you. Also, if anyone can tell me
why Regex is...
|
by: miguel |
last post by:
Hi,
I have created a service which parses real-time prices from one format
into another. This is all working very quickly and nicely, however, I
have recently found that the memory usage is astronomical after a few
hours. (1.5-2 Gig)
After a good amount of digging I found that the memory usage is is all
in System.String and contained within the pricing object. This object
makes extensive use of a single string object which is...
|
by: |
last post by:
I am interested in scanning web pages for content of interest, and then
auto-classifying that content. I have tables of metadata that I can use for
the classification, e.g. : "John P. Jones" "Jane T. Smith" "Fred Barzowsky"
"Department of Oncology" "Office of Student Affairs" "Lewis Hall" etc. etc.
etc.
I am wondering what the efficient way to do this in code might be. The dumb
and brute-force way would be to loop through the content...
|
by: NeoPa |
last post by:
ANSI-89 v ANSI-92
Before we get into all the various types of pattern matching that can be used, there are two ANSI standards used for the main types of wildcard matching (matching zero or more characters or simply matching a single character) :
ANSI-89 - Mainly used only by Jet / ACE SQL
ANSI-92 - Mainly used by SQL Server and other grown-up products
In the later versions of Access it is now possible to select ANSI-92 compatibility as an...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |