Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #12000

Re: finding newlines

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: finding newlines
Date 2013-11-27 11:47 -0500
Organization A noiseless patient Spider
Message-ID <l757ne$ncm$1@dont-email.me> (permalink)
References <l6vst0$ijk$1@speranza.aioe.org> <l70fsg$7dg$1@dont-email.me> <l74gg6$tr7$1@speranza.aioe.org>

Show all headers | View raw


On 11/27/2013 5:11 AM, bill wrote:
> On 11/25/2013 4:36 PM, Jerry Stuckle wrote:
>> On 11/25/2013 11:12 AM, bill wrote:
>>> I am trying to find the first line bread in a string
>>> where string = "Hand Carried by Patient\n\nTo Whom It May
>>> Concern:\n\nR...."
>>>
>>> This code does not work: $pos = strpos($progressNote,"\n\n");
>>> it returns pos = false
>>>
>>> where do I err?
>>>
>>> bill
>>
>> How did you get the string in $progressNote?  Did you set it
>> yourself, or was it possibly sourced from a web page?
>>
>> What do you get if you echo $progressNote?
>>
>>
> I create the progress note in another script that is POSTed to this one.
>
> looking at progress note tells me that is is as I said, actually, I
> copied it from the display of the debug statement:
>
> echo basename(__FILE__) . ": " . __LINE__ .
> ":progNote=>$progressNote<<br />";
>
> As it should work, and does not, I will spend more time on it tomorrow
> (when I have the time.
>
> thanks
>
> bill

OK, in that case you have the characters '\' and 'n'.  In PHP,
"\n" is a newline character.  You need to either escape the '\' as in 
"\\n\\n", or use single quotes around your string, i.e. '\n\n'.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

finding newlines bill <william@TechServSys.com> - 2013-11-25 11:12 -0500
  Re: finding newlines Christoph Michael Becker <cmbecker69@arcor.de> - 2013-11-25 17:32 +0100
    Re: finding newlines bill <william@TechServSys.com> - 2013-11-26 09:36 -0500
  Re: finding newlines Richard Yates <richard@yatesguitar.com> - 2013-11-25 08:34 -0800
  Re: finding newlines Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-25 20:11 +0000
    Re: finding newlines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-25 22:23 +0100
    Re: finding newlines Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-26 18:05 +0000
      Re: finding newlines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-26 19:46 +0100
        Re: finding newlines Wizard-Of-Oz <somewhere@over.rainbow.com> - 2013-11-30 16:50 +0000
          Re: finding newlines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-01 17:11 +0100
  Re: finding newlines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-25 22:18 +0100
  Re: finding newlines Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-25 16:36 -0500
    Re: finding newlines bill <william@TechServSys.com> - 2013-11-27 05:11 -0500
      Re: finding newlines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-27 16:56 +0100
        Re: finding newlines bill <william@TechServSys.com> - 2013-11-28 11:42 -0500
          Re: finding newlines Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-28 20:20 +0100
          Re: finding newlines Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-29 00:57 +0000
      Re: finding newlines Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-27 11:47 -0500
        Re: finding newlines bill <william@TechServSys.com> - 2013-11-28 11:09 -0500

csiph-web