Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[bug #39078] The method -[NSScanner scanUpToString:intoString] can't find a pattern at the very start of a string

7 views
Skip to first unread message

Sergey Golovin

unread,
May 27, 2013, 6:33:34 AM5/27/13
to Sergey Golovin, bug-g...@gnu.org
URL:
<http://savannah.gnu.org/bugs/?39078>

Summary: The method -[NSScanner scanUpToString:intoString]
can't find a pattern at the very start of a string
Project: GNUstep
Submitted by: svg
Submitted on: Пнд 27 Май 2013 14:33:33
Category: Base/Foundation
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any

_______________________________________________________

Details:

Consider the following code:
------------------------------------------------------------
NSString *str = @"/** comment */";
NSScanner *scan;
NSString *comment = nil;

scan = [NSScanner scannerWithString: str];

if([scan scanUpToString: @"/**" intoString: &comment] &&
[comment isEqualToString: @""])
{
NSLog(@"OK");
}
else
{
NSLog(@"FAIL");
}
------------------------------------------------------------

Here the pattern @"/**" at the start of the 'str' is never found
by the 'scan'.

I'm guessing (from a practical point of view because i have no
access to OS X) it should return YES and populate 'comment' by
an empty string.

In the case i'm right the test is attached.



_______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Пнд 27 Май 2013 14:33:33 Name: test02.m Size: 705B By: svg

<http://savannah.gnu.org/bugs/download.php?file_id=28186>

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?39078>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/


Graham Lee

unread,
May 27, 2013, 4:31:38 PM5/27/13
to Sergey Golovin, Graham Lee, bug-g...@gnu.org
Follow-up Comment #1, bug #39078 (project gnustep):

This is expected behaviour, AFAICT. From Apple's documentation:

If stopString is the first string in the receiver, then the method returns NO
and stringValue is not changed.

Having run the test on Mac OS X (10.8.3), the behaviour is compatible with
what you describe for GNUstep.

Sergey Golovin

unread,
May 27, 2013, 11:06:39 PM5/27/13
to Sergey Golovin, Graham Lee, bug-g...@gnu.org
Follow-up Comment #2, bug #39078 (project gnustep):

I have missed that statement. Sorry for false alarm.

The report can be closed.

Richard Frith-Macdonald

unread,
May 31, 2013, 5:34:41 AM5/31/13
to Richard Frith-Macdonald, Sergey Golovin, Graham Lee, bug-g...@gnu.org
Update of bug #39078 (project gnustep):

Status: None => Invalid
Open/Closed: Open => Closed
0 new messages