Click here to get back home

Problem with sscanf

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Problem with sscanf Tim Streater 06-24-2008
---> Re: Problem with sscanf =?ISO-8859-1?Q?...06-24-2008
---> Re: Problem with sscanf =?ISO-8859-1?Q?...06-24-2008
Get Chitika Premium
Posted by Tim Streater on June 24, 2008, 9:03 am
Please log in for more thread options
I'm obviously missing something here. I have a line like this (in
$line), and I want all the text within the double quotes::

somestr="string I want"

with some whitespace at the beginning. So I try this:

$res = sscanf ($line, ' %s"%s"');
$wanted = $res[1];

This appears to put the whole string in $res[0] (possibly minus the
whitespace). What am I doing wrong?

TIA - tim

Posted by Olaf Schinkel on June 24, 2008, 10:01 am
Please log in for more thread options
Tim Streater schrieb:
> I'm obviously missing something here. I have a line like this (in
> $line), and I want all the text within the double quotes::
>
> somestr="string I want"
>
> with some whitespace at the beginning. So I try this:
>
> $res = sscanf ($line, ' %s"%s"');
> $wanted = $res[1];
>
> This appears to put the whole string in $res[0] (possibly minus the
> whitespace). What am I doing wrong?
>
> TIA - tim
You are looking for:
preg_match_all();



Posted by =?ISO-8859-1?Q?=22=C1lvaro_G=2 on June 24, 2008, 10:08 am
Please log in for more thread options
Tim Streater escribió:
> $res = sscanf ($line, ' %s"%s"');
> $wanted = $res[1];
>
> This appears to put the whole string in $res[0] (possibly minus the
> whitespace). What am I doing wrong?

Well, that depends on what $line looks like. Can we see it?


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--

Posted by Captain Paralytic on June 24, 2008, 10:21 am
Please log in for more thread options
On 24 Jun, 15:08, "=C1lvaro G. Vicario"
> Tim Streater escribi=F3:
>
> > $res =3D sscanf ($line, ' %s"%s"');
> > $wanted =3D $res[1];
>
> > This appears to put the whole string in $res[0] (possibly minus the
> > whitespace). What am I doing wrong?
>
> Well, that depends on what $line looks like. Can we see it?
>
He told you in the OP

Posted by =?ISO-8859-1?Q?=22=C1lvaro_G=2 on June 24, 2008, 10:27 am
Please log in for more thread options
Captain Paralytic escribió:
>>> $res = sscanf ($line, ' %s"%s"');
>>> $wanted = $res[1];
>>> This appears to put the whole string in $res[0] (possibly minus the
>>> whitespace). What am I doing wrong?
>> Well, that depends on what $line looks like. Can we see it?
>>
> He told you in the OP

I guess you're right; I was confused because I was expecting actual
code, not a description of it xD


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--

Similar ThreadsPosted
Problem of php_ldap.dll in appserv 2.4.3 and Problem of Apache server in appserv 2.5.3 January 27, 2005, 7:53 pm
PHP with WML problem July 26, 2004, 10:27 pm
Var problem ... September 9, 2004, 9:25 pm
BIG problem. January 17, 2005, 7:05 pm
css problem February 28, 2005, 5:44 pm
Problem April 11, 2005, 5:05 pm
Problem.... May 31, 2005, 10:37 pm
Can anyone help me with this problem please....? July 14, 2005, 11:41 pm
php.ini problem October 20, 2005, 4:44 am
A problem with '"' October 22, 2005, 2:29 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap