bugGNUstep - Bugs: bug #39078, The method -[NSScanner...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitted by:  Sergei Golovin <svg>
Submitted on:  Mon 27 May 2013 10:33:33 AM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: Closed

Tue 28 May 2013 03:06:39 AM UTC, comment #2:

I have missed that statement. Sorry for false alarm.

The report can be closed.

Sergei Golovin <svg>
Mon 27 May 2013 08:31:38 PM UTC, comment #1:

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.

Graham Lee <leeg>
Mon 27 May 2013 10:33:33 AM UTC, original submission:

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.

Sergei Golovin <svg>

 

Attached Files
file #28186:  test02.m added by svg (705B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Updated the item)
  • -unavailable- added by leeg (Posted a comment)
  • -unavailable- added by svg (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 31 May 2013 09:34:41 AM UTCCaSStatusNone=>Invalid
      Open/ClosedOpen=>Closed
    Mon 27 May 2013 10:33:33 AM UTCsvgAttached File-=>Added test02.m, #28186

    Back to the top


    Powered by Savane 3.1-cleanup1