bugGNUstep - Bugs: bug #3824, -scanString:intoString (NSScanner)...

Group
 
 

bug #3824: -scanString:intoString (NSScanner) doesn't work on @"\r\n"

Submitter:  -Deleted Account- <yjchen>
Submitted:  Fri 30 May 2003 02:44:55 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 20 Jun 2003 07:00:50 PM UTC, comment #1: 

Not a bug ... that's the correct/expected behavior.
You can't scan \r\n without shanging the set of characters to be skipped.

Richard Frith-Macdonald <CaS>
Group Member
Fri 30 May 2003 02:44:55 PM UTC, original submission:  

Here is the test code and result:

Test1: Search "one".

#include <AppKit/AppKit.h>

int main(int argc, const char *argv[])
{
  NSAutoreleasePool *pool = [NSAutoreleasePool new];

  NSString *string = @"Line one\r\nLine two\r\nLine three\r\n";
  NSScanner *scanner = [NSScanner scannerWithString: string];
  NSString *search = @"one";
  NSString *resultString;
  BOOL result;

  result = [scanner scanUpToString: search intoString: &resultString];
  NSLog(@"resultString *%@*, BOOL %d", resultString, result);
  result = [scanner scanString: search intoString: &resultString];
  NSLog(@"resultString *%@*, BOOL %d", resultString, result);

  RELEASE(pool);
  return 0;
}

Result:

2003-05-30 10:41:59.527 Test[1646] resultString *Line *, BOOL 1
2003-05-30 10:41:59.532 Test[1646] resultString *one*, BOOL 1

This is a correct behavior.

Test2:

Change ' NSString *search = @"\r\n"; ' to search @"\r\n"

Result:

2003-05-30 10:42:35.939 Test[1679] resultString *Line one*, BOOL 1
2003-05-30 10:42:35.944 Test[1679] resultString *Line one*, BOOL 0

 

-Deleted Account- <yjchen>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-05-22 FredKiefer StatusNone Invalid
    Open/ClosedDeclined Closed
2003-06-20 CaS Open/ClosedOpen None

Back to the top

Powered by Savane 3.13-bb6a.
Corresponding source code