473,394 Members | 1,752 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,394 software developers and data experts.

How to find a quote in a string

I have a text file. My text file contains lines with double quotes
around it. I trying to code if a line has double quotes around it Then
make it bold

My code is below and it is not working. Please Help
<?

$filename = "whatsnew.txt"; # file to read

if (file_exists($filename)) {

# Get a handle to the asdfile
$file = file($filename);
echo "<p style='font-family:Arial; font-size:x-small'>";
foreach($file as $line) {
if (strpos($line,"\"") 0) {

$line = "<b>" . $line . "</b>";
}
$line .= "<br />";
echo $line;
}
echo "</p>";
}
?>
Oct 23 '08 #1
9 4546
*** WebArchitect escribió/wrote (Thu, 23 Oct 2008 09:53:22 -0700 (PDT)):
I have a text file. My text file contains lines with double quotes
around it. I trying to code if a line has double quotes around it Then
make it bold

My code is below and it is not working. Please Help
<?

$filename = "whatsnew.txt"; # file to read

if (file_exists($filename)) {

# Get a handle to the asdfile
$file = file($filename);
echo "<p style='font-family:Arial; font-size:x-small'>";
foreach($file as $line) {
if (strpos($line,"\"") 0) {

$line = "<b>" . $line . "</b>";
}
$line .= "<br />";
echo $line;
}
echo "</p>";
}
You don't give any clue about how your code is failing to work so I won't
guess. But the most obvious error I can see is discarding lines that begin
with quotes. From manual:

"This function may return Boolean FALSE, but may also return a non-Boolean
value which evaluates to FALSE, such as 0 or "". Please read the section on
Booleans for more information. Use the === operator for testing the return
value of this function."

http://es.php.net/strpos

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
Oct 23 '08 #2
WebArchitect wrote:
I have a text file. My text file contains lines with double quotes
around it. I trying to code if a line has double quotes around it Then
make it bold

My code is below and it is not working. Please Help
<?

$filename = "whatsnew.txt"; # file to read

if (file_exists($filename)) {

# Get a handle to the asdfile
$file = file($filename);
echo "<p style='font-family:Arial; font-size:x-small'>";
foreach($file as $line) {
if (strpos($line,"\"") 0) {

$line = "<b>" . $line . "</b>";
}
$line .= "<br />";
echo $line;
}
echo "</p>";
}
?>
Your problem is how you're handling strpos(). Since you want to find
if quotes enclose a string, 0 will be the index at which the first
pair of quotes occur. Also, you should use htmlspecialchars() since
you're outputting data in an HTML document. A better way to test would be:

/* inside loop */
$line = htmlspecialchars($line);
if (strpos($line,'"') === 0 && strrpos($line,'"') == strlen($line) - 1)
echo "<b>$line</b><br />\n"
else
echo "$line<br />\n";

Although there's nothing wrong with how you handle output, I just used
a style, which, IMO, seems simpler; so feel free to take it or leave it.
--
Curtis
Oct 23 '08 #3
On Oct 23, 4:26*pm, "Álvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.comwrote:
*** WebArchitect escribió/wrote (Thu, 23 Oct 2008 09:53:22 -0700 (PDT)):


I have a text file. My text file contains lines with double quotes
around it. I trying to code if a line has double quotes around it Then
make it bold
My code is below and it is not working. Please Help
<?
$filename = "whatsnew.txt"; * *# file to read
if (file_exists($filename)) {
* * # Get a handle to the asdfile
* * $file = file($filename);
* * echo "<p style='font-family:Arial; font-size:x-small'>";
* * foreach($file as $line) {
* * if (strpos($line,"\"") 0) {
* * $line = "<b>" . $line . "</b>";
* * }
* * * * $line .= "<br />";
* * * *echo $line;
* * }
* * echo "</p>";
}

You don't give any clue about how your code is failing to work so I won't
guess. But the most obvious error I can see is discarding lines that begin
with quotes. From manual:

"This function may return Boolean FALSE, but may also return a non-Boolean
value which evaluates to FALSE, such as 0 or "". Please read the section on
Booleans for more information. Use the === operator for testing thereturn
value of this function."

http://es.php.net/strpos
When I first read that a few months ago about it may be FALSE, 0 or ""
I said, "Strange, but ok". Now wonder, why? And in what case would it
be FALSE, 0 or ""? It seems a vague explanation for something very
specific.

Bill H
Oct 24 '08 #4
Bill H wrote:
On Oct 23, 4:26 pm, "Álvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.comwrote:
>*** WebArchitect escribió/wrote (Thu, 23 Oct 2008 09:53:22 -0700 (PDT)):


>>I have a text file. My text file contains lines with double quotes
around it. I trying to code if a line has double quotes around it Then
make it bold
My code is below and it is not working. Please Help
<?
$filename = "whatsnew.txt"; # file to read
if (file_exists($filename)) {
# Get a handle to the asdfile
$file = file($filename);
echo "<p style='font-family:Arial; font-size:x-small'>";
foreach($file as $line) {
if (strpos($line,"\"") 0) {
$line = "<b>" . $line . "</b>";
}
$line .= "<br />";
echo $line;
}
echo "</p>";
}
You don't give any clue about how your code is failing to work so I won't
guess. But the most obvious error I can see is discarding lines that begin
with quotes. From manual:

"This function may return Boolean FALSE, but may also return a non-Boolean
value which evaluates to FALSE, such as 0 or "". Please read the section on
Booleans for more information. Use the === operator for testing the return
value of this function."

http://es.php.net/strpos

When I first read that a few months ago about it may be FALSE, 0 or ""
I said, "Strange, but ok". Now wonder, why? And in what case would it
be FALSE, 0 or ""? It seems a vague explanation for something very
specific.

Bill H
It seems fairly clear. If the search failed, strpos() returns boolean
FALSE, as opposed to 0 or an empty string. The problem is that the
strpos() return value MUST differentiate between FALSE and 0. Take,
for example:

$haystack = '"foo."';
$pos = strpos($haystack, '"');
if (!$pos) {
echo 'No match. Maybe...';
} else {
echo 'Found match at index: ' . $pos;
}

$pos will hold 0, of type integer. So, while you may think you're
checking for the case in which no match occurred (using == or the
unary !), you will get unexpected results when a match was found at
index 0, as shown above. Thus the above conditional statement is
better written as:

if ($pos === false) {
echo 'Definitely no match.';
} else {
echo 'Found match at index: ' . $pos;
}

--
Curtis
Oct 24 '08 #5
On Oct 23, 8:57*pm, Curtis <dye...@gmail.comwrote:
Bill H wrote:
On Oct 23, 4:26 pm, "Álvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.comwrote:
*** WebArchitect escribió/wrote (Thu, 23 Oct 2008 09:53:22 -0700 (PDT)):
>I have a text file. My text file contains lines with double quotes
around it. I trying to code if a line has double quotes around it Then
make it bold
My code is below and it is not working. Please Help
<?
$filename = "whatsnew.txt"; * *# file to read
if (file_exists($filename)) {
* * # Get a handle to the asdfile
* * $file = file($filename);
* * echo "<p style='font-family:Arial; font-size:x-small'>";
* * foreach($file as $line) {
* * if (strpos($line,"\"") 0) {
* * $line = "<b>" . $line . "</b>";
* * }
* * * * $line .= "<br />";
* * * *echo $line;
* * }
* * echo "</p>";
}
You don't give any clue about how your code is failing to work so I won't
guess. But the most obvious error I can see is discarding lines that begin
with quotes. From manual:
"This function may return Boolean FALSE, but may also return a non-Boolean
value which evaluates to FALSE, such as 0 or "". Please read the section on
Booleans for more information. Use the === operator for testing the return
value of this function."
>http://es.php.net/strpos
When I first read that a few months ago about it may be FALSE, 0 or ""
I said, "Strange, but ok". Now wonder, why? And in what case would it
be FALSE, 0 or ""? It seems a vague explanation for something very
specific.
Bill H

It seems fairly clear. If the search failed, strpos() returns boolean
FALSE, as opposed to 0 or an empty string. The problem is that the
strpos() return value MUST differentiate between FALSE and 0. Take,
for example:

$haystack = '"foo."';
$pos = strpos($haystack, '"');
if (!$pos) {
* *echo 'No match. Maybe...';} else {

* *echo 'Found match at index: ' . $pos;

}

$pos will hold 0, of type integer. So, while you may think you're
checking for the case in which no match occurred (using == or the
unary !), you will get unexpected results when a match was found at
index 0, as shown above. Thus the above conditional statement is
better written as:

if ($pos === false) {
* *echo 'Definitely no match.';} else {

* *echo 'Found match at index: ' . $pos;

}

--
Curtis- Hide quoted text -

- Show quoted text -
I get the FALSE and the 0, I just don't get having "" returned.

Bill H
Oct 24 '08 #6
Bill H wrote:
On Oct 23, 8:57 pm, Curtis <dye...@gmail.comwrote:
>Bill H wrote:
>>On Oct 23, 4:26 pm, "Álvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.comwrote:
*** WebArchitect escribió/wrote (Thu, 23 Oct 2008 09:53:22 -0700 (PDT)):
I have a text file. My text file contains lines with double quotes
around it. I trying to code if a line has double quotes around it Then
make it bold
My code is below and it is not working. Please Help
<?
$filename = "whatsnew.txt"; # file to read
if (file_exists($filename)) {
# Get a handle to the asdfile
$file = file($filename);
echo "<p style='font-family:Arial; font-size:x-small'>";
foreach($file as $line) {
if (strpos($line,"\"") 0) {
$line = "<b>" . $line . "</b>";
}
$line .= "<br />";
echo $line;
}
echo "</p>";
}
You don't give any clue about how your code is failing to work so I won't
guess. But the most obvious error I can see is discarding lines that begin
with quotes. From manual:
"This function may return Boolean FALSE, but may also return a non-Boolean
value which evaluates to FALSE, such as 0 or "". Please read the section on
Booleans for more information. Use the === operator for testing the return
value of this function."
http://es.php.net/strpos
When I first read that a few months ago about it may be FALSE, 0 or ""
I said, "Strange, but ok". Now wonder, why? And in what case would it
be FALSE, 0 or ""? It seems a vague explanation for something very
specific.
Bill H
It seems fairly clear. If the search failed, strpos() returns boolean
FALSE, as opposed to 0 or an empty string. The problem is that the
strpos() return value MUST differentiate between FALSE and 0. Take,
for example:

$haystack = '"foo."';
$pos = strpos($haystack, '"');
if (!$pos) {
echo 'No match. Maybe...';} else {

echo 'Found match at index: ' . $pos;

}

$pos will hold 0, of type integer. So, while you may think you're
checking for the case in which no match occurred (using == or the
unary !), you will get unexpected results when a match was found at
index 0, as shown above. Thus the above conditional statement is
better written as:

if ($pos === false) {
echo 'Definitely no match.';} else {

echo 'Found match at index: ' . $pos;

}

--
Curtis- Hide quoted text -

- Show quoted text -

I get the FALSE and the 0, I just don't get having "" returned.

Bill H
It seems to me, they are simply stating it as an example. They are
referring to the fact that FALSE evaluates to 0 or an empty string,
not that strpos() can specifically return an empty string.*

I have never seen strpos() or strrpos() return an empty string,
although, this is just from my experiences using the functions...

* However, after more carefully reading the wording of the warning, it
does seem to suggest that an empty string may be returned, although I
have never found this to be the case. It is possible that the
documentation authors may have let such a suggestion slip through by
accident.

--
Curtis
Oct 24 '08 #7
On Oct 24, 5:48*am, Curtis <dye...@gmail.comwrote:
Bill H wrote:
On Oct 23, 8:57 pm, Curtis <dye...@gmail.comwrote:
Bill H wrote:
On Oct 23, 4:26 pm, "Álvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.comwrote:
*** WebArchitect escribió/wrote (Thu, 23 Oct 2008 09:53:22 -0700 (PDT)):
I have a text file. My text file contains lines with double quotes
around it. I trying to code if a line has double quotes around it Then
make it bold
My code is below and it is not working. Please Help
<?
$filename = "whatsnew.txt"; * *# file to read
if (file_exists($filename)) {
* * # Get a handle to the asdfile
* * $file = file($filename);
* * echo "<p style='font-family:Arial; font-size:x-small'>";
* * foreach($file as $line) {
* * if (strpos($line,"\"") 0) {
* * $line = "<b>" . $line . "</b>";
* * }
* * * * $line .= "<br />";
* * * *echo $line;
* * }
* * echo "</p>";
}
You don't give any clue about how your code is failing to work so I won't
guess. But the most obvious error I can see is discarding lines thatbegin
with quotes. From manual:
"This function may return Boolean FALSE, but may also return a non-Boolean
value which evaluates to FALSE, such as 0 or "". Please read the section on
Booleans for more information. Use the === operator for testing the return
value of this function."
http://es.php.net/strpos
When I first read that a few months ago about it may be FALSE, 0 or ""
I said, "Strange, but ok". Now wonder, why? And in what case would it
be FALSE, 0 or ""? It seems a vague explanation for something very
specific.
Bill H
It seems fairly clear. If the search failed, strpos() returns boolean
FALSE, as opposed to 0 or an empty string. The problem is that the
strpos() return value MUST differentiate between FALSE and 0. Take,
for example:
$haystack = '"foo."';
$pos = strpos($haystack, '"');
if (!$pos) {
* *echo 'No match. Maybe...';} else {
* *echo 'Found match at index: ' . $pos;
}
$pos will hold 0, of type integer. So, while you may think you're
checking for the case in which no match occurred (using == or the
unary !), you will get unexpected results when a match was found at
index 0, as shown above. Thus the above conditional statement is
better written as:
if ($pos === false) {
* *echo 'Definitely no match.';} else {
* *echo 'Found match at index: ' . $pos;
}
--
Curtis- Hide quoted text -
- Show quoted text -
I get the FALSE and the 0, I just don't get having "" returned.
Bill H

It seems to me, they are simply stating it as an example. They are
referring to the fact that FALSE evaluates to 0 or an empty string,
not that strpos() can specifically return an empty string.*

I have never seen strpos() or strrpos() return an empty string,
although, this is just from my experiences using the functions...

* However, after more carefully reading the wording of the warning, it
does seem to suggest that an empty string may be returned, although I
have never found this to be the case. It is possible that the
documentation authors may have let such a suggestion slip through by
accident.

--
Curtis- Hide quoted text -

- Show quoted text -
I know it would just be a personal preference, but in the case of
strpos() (and maybe others, it would be nice if instead of FALSE if
not found, it returned -1 like Perl, Actionscript, Java and I believe
C... Would eliminate the need for the "Really equals" (what I call the
===).

I have always felt that FALSE should be -1, TRUE should be 1, since
everything in programming is zero-indexed.

Bill H
Oct 24 '08 #8
Bill H wrote:
On Oct 24, 5:48 am, Curtis <dye...@gmail.comwrote:
>Bill H wrote:
>>On Oct 23, 8:57 pm, Curtis <dye...@gmail.comwrote:
Bill H wrote:
On Oct 23, 4:26 pm, "Álvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.comwrote:
>*** WebArchitect escribió/wrote (Thu, 23 Oct 2008 09:53:22 -0700 (PDT)):
>>I have a text file. My text file contains lines with double quotes
>>around it. I trying to code if a line has double quotes around it Then
>>make it bold
>>My code is below and it is not working. Please Help
>><?
>>$filename = "whatsnew.txt"; # file to read
>>if (file_exists($filename)) {
>> # Get a handle to the asdfile
>> $file = file($filename);
>> echo "<p style='font-family:Arial; font-size:x-small'>";
>> foreach($file as $line) {
>> if (strpos($line,"\"") 0) {
>> $line = "<b>" . $line . "</b>";
>> }
>> $line .= "<br />";
>> echo $line;
>> }
>> echo "</p>";
>>}
>You don't give any clue about how your code is failing to work so I won't
>guess. But the most obvious error I can see is discarding lines that begin
>with quotes. From manual:
>"This function may return Boolean FALSE, but may also return a non-Boolean
>value which evaluates to FALSE, such as 0 or "". Please read the section on
>Booleans for more information. Use the === operator for testing the return
>value of this function."
>http://es.php.net/strpos
When I first read that a few months ago about it may be FALSE, 0 or ""
I said, "Strange, but ok". Now wonder, why? And in what case would it
be FALSE, 0 or ""? It seems a vague explanation for something very
specific.
Bill H
It seems fairly clear. If the search failed, strpos() returns boolean
FALSE, as opposed to 0 or an empty string. The problem is that the
strpos() return value MUST differentiate between FALSE and 0. Take,
for example:
$haystack = '"foo."';
$pos = strpos($haystack, '"');
if (!$pos) {
echo 'No match. Maybe...';} else {
echo 'Found match at index: ' . $pos;
}
$pos will hold 0, of type integer. So, while you may think you're
checking for the case in which no match occurred (using == or the
unary !), you will get unexpected results when a match was found at
index 0, as shown above. Thus the above conditional statement is
better written as:
if ($pos === false) {
echo 'Definitely no match.';} else {
echo 'Found match at index: ' . $pos;
}
--
Curtis- Hide quoted text -
- Show quoted text -
I get the FALSE and the 0, I just don't get having "" returned.
Bill H
It seems to me, they are simply stating it as an example. They are
referring to the fact that FALSE evaluates to 0 or an empty string,
not that strpos() can specifically return an empty string.*

I have never seen strpos() or strrpos() return an empty string,
although, this is just from my experiences using the functions...

* However, after more carefully reading the wording of the warning, it
does seem to suggest that an empty string may be returned, although I
have never found this to be the case. It is possible that the
documentation authors may have let such a suggestion slip through by
accident.

--
Curtis- Hide quoted text -

- Show quoted text -

I know it would just be a personal preference, but in the case of
strpos() (and maybe others, it would be nice if instead of FALSE if
not found, it returned -1 like Perl, Actionscript, Java and I believe
C... Would eliminate the need for the "Really equals" (what I call the
===).

I have always felt that FALSE should be -1, TRUE should be 1, since
everything in programming is zero-indexed.
Not necessarily, not all languages use zero-based indexeing, for
example. Perl also allows n-based indexing via the predefined var,
"$[". Also, Fortran and awk use 1-based indexing, IIRC.
Bill H
You could always write your custom wrapper for the strpos()
function(s). Something like:

<?php
function my_strpos($haystack, $needle, $offset = null)
{
return ($pos = strpos($haystack, $needle, $offset)) === false
? -1
: $pos;
}
?>

Although, personally, I wouldn't think it would be worth the trouble.
--
Curtis
Oct 25 '08 #9
On Oct 25, 5:36*am, Curtis <dye...@gmail.comwrote:
Bill H wrote:
On Oct 24, 5:48 am, Curtis <dye...@gmail.comwrote:
Bill H wrote:
On Oct 23, 8:57 pm, Curtis <dye...@gmail.comwrote:
Bill H wrote:
On Oct 23, 4:26 pm, "Álvaro G. Vicario"
<webmasterNOSPAMTHA...@demogracia.comwrote:
*** WebArchitect escribió/wrote (Thu, 23 Oct 2008 09:53:22 -0700(PDT)):
>I have a text file. My text file contains lines with double quotes
>around it. I trying to code if a line has double quotes around itThen
>make it bold
>My code is below and it is not working. Please Help
><?
>$filename = "whatsnew.txt"; * *# file to read
>if (file_exists($filename)) {
>* * # Get a handle to the asdfile
>* * $file = file($filename);
>* * echo "<p style='font-family:Arial; font-size:x-small'>";
>* * foreach($file as $line) {
>* * if (strpos($line,"\"") 0) {
>* * $line = "<b>" . $line . "</b>";
>* * }
>* * * * $line .= "<br />";
>* * * *echo $line;
>* * }
>* * echo "</p>";
>}
You don't give any clue about how your code is failing to work so I won't
guess. But the most obvious error I can see is discarding lines that begin
with quotes. From manual:
"This function may return Boolean FALSE, but may also return a non-Boolean
value which evaluates to FALSE, such as 0 or "". Please read the section on
Booleans for more information. Use the === operator for testing the return
value of this function."
>http://es.php.net/strpos
When I first read that a few months ago about it may be FALSE, 0 or""
I said, "Strange, but ok". Now wonder, why? And in what case would it
be FALSE, 0 or ""? It seems a vague explanation for something very
specific.
Bill H
It seems fairly clear. If the search failed, strpos() returns boolean
FALSE, as opposed to 0 or an empty string. The problem is that the
strpos() return value MUST differentiate between FALSE and 0. Take,
for example:
$haystack = '"foo."';
$pos = strpos($haystack, '"');
if (!$pos) {
* *echo 'No match. Maybe...';} else {
* *echo 'Found match at index: ' . $pos;
}
$pos will hold 0, of type integer. So, while you may think you're
checking for the case in which no match occurred (using == or the
unary !), you will get unexpected results when a match was found at
index 0, as shown above. Thus the above conditional statement is
better written as:
if ($pos === false) {
* *echo 'Definitely no match.';} else {
* *echo 'Found match at index: ' . $pos;
}
--
Curtis- Hide quoted text -
- Show quoted text -
I get the FALSE and the 0, I just don't get having "" returned.
Bill H
It seems to me, they are simply stating it as an example. They are
referring to the fact that FALSE evaluates to 0 or an empty string,
not that strpos() can specifically return an empty string.*
I have never seen strpos() or strrpos() return an empty string,
although, this is just from my experiences using the functions...
* However, after more carefully reading the wording of the warning, it
does seem to suggest that an empty string may be returned, although I
have never found this to be the case. It is possible that the
documentation authors may have let such a suggestion slip through by
accident.
--
Curtis- Hide quoted text -
- Show quoted text -
I know it would just be a personal preference, but in the case of
strpos() (and maybe others, it would be nice if instead of FALSE if
not found, it returned -1 like Perl, Actionscript, Java and I believe
C... Would eliminate the need for the "Really equals" (what I call the
===).
I have always felt that FALSE should be -1, TRUE should be 1, since
everything in programming is zero-indexed.

Not necessarily, not all languages use zero-based indexeing, for
example. Perl also allows n-based indexing via the predefined var,
"$[". Also, Fortran and awk use 1-based indexing, IIRC.
Bill H

You could always write your custom wrapper for the strpos()
function(s). Something like:

<?php
function my_strpos($haystack, $needle, $offset = null)
{
* *return ($pos = strpos($haystack, $needle, $offset)) === false
* * *? -1
* * *: $pos;}

?>

Although, personally, I wouldn't think it would be worth the trouble.
--
Curtis
Bill,

I guess this is just part of dealing with the loosely-typed nature of
php. the problem is that using:

"if($var)"
"empty($var)"
"isset($var)"

are shortcuts and the following usually evaluate to "FALSE" for the
above funcs and similar (nor a rule, more like a pattern):
0
0.0
""
"0"
false
null

so the point of the === operator is to avoid this kind of confusion
because in some contexts (string/array searches etc) the result 0 is
actually considered "TRUE". Curtis gave a pretty good example.
Oct 25 '08 #10

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

Similar topics

7
by: Christian Christmann | last post by:
Hi, I've profiled one of my C++ projects and figured out that the program spends a lot of time with STL map's function "find". One of my classes possesses an STL map of the structure map<...
3
by: andrewcw | last post by:
I looked at this code on MSDN ( and at article in MSDN magazine this month ): The code below suggests that I may be able to use the find function of generics to locate the object easily as opposed...
6
by: Registered User | last post by:
Hi experts, I'm trying to write a program to solve the following exercise: Accept three strings from the user. Find the first occurrence of the first string in the third string. If it is present...
2
by: alacrite | last post by:
With this testprogram: #include <iostream> #include <string> using namespace std; int main() {
4
by: lovecreatesbea... | last post by:
The find() in <algorithmrequires two input iterators as its first and second arguments. In some of my code, I use vector<T>::begin() and vector<T>::end() as the first and second arguments. The...
11
by: Ko van der Sloot | last post by:
Hello I was wondering which behaviour might be expected (or is required) for the following small program. I would expect that find( "a", string::npos ) would return string::npos but is seems to...
7
by: Adrian | last post by:
Why does std::strings find search from the begining of the string when pos >= (std::string::npos-3) I cant find anything in the standard that says what find should do if pos==npos in find I...
9
by: Satish Itty | last post by:
How do I write the following c# code in vb Product FindProduct(string code) { List<Productproducts = getProducts(); return products.Find(delegate(Product bo) { return bo.Code == code; }); }
22
by: Steve Richter | last post by:
Does the .NET framework provide a class which will find the item in the collection with a key which is closest ( greater than or equal, less than or equal ) to the keys of the collection? ex:...
2
by: korean_dave | last post by:
How can i use the find() function on a string that is composed of tons of symbols that cause errors... THis is my string: find("<html><head><meta name="qrichtext" content="1" /><style...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...

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.