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

 
 

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

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

Submitted by:  -Deleted Account- <yjchen>
Submitted on:  Fri 30 May 2003 02:44:55 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: Closed

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>
Project 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>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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
Sun 22 May 2005 11:18:41 PM UTCFredKieferStatusNone=>Invalid
  Open/ClosedDeclined=>Closed
Fri 20 Jun 2003 07:00:50 PM UTCCaSOpen/ClosedOpen=>(Error - Not Found)

Back to the top


Powered by Savane 3.1-cleanup1