Revision: 27892
http://sourceforge.net/p/bibdesk/svn/27892
Author: hofman
Date: 2022-09-15 17:26:14 +0000 (Thu, 15 Sep 2022)
Log Message:
-----------
find character instead of using NSScanner
Modified Paths:
--------------
trunk/bibdesk/BDSKScriptMenu.m
Modified: trunk/bibdesk/BDSKScriptMenu.m
===================================================================
--- trunk/bibdesk/BDSKScriptMenu.m 2022-09-15 16:48:11 UTC (rev 27891)
+++ trunk/bibdesk/BDSKScriptMenu.m 2022-09-15 17:26:14 UTC (rev 27892)
@@ -42,6 +42,7 @@
#import "NSString_BDSKExtensions.h"
#import "BDSKTask.h"
#import "NSFileManager_BDSKExtensions.h"
+#import "NSCharacterSet_BDSKExtensions.h"
#define SCRIPTS_MENU_TITLE @"Scripts"
#define SCRIPTS_FOLDER_NAME @"Scripts"
@@ -183,10 +184,9 @@
NSString *title = [file lastPathComponent];
NSDictionary *dict = nil;
- NSScanner *scanner = [NSScanner scannerWithString:title];
- [scanner setCharactersToBeSkipped:nil];
- if ([scanner scanCharactersFromSet:[NSCharacterSet
decimalDigitCharacterSet] intoString:NULL] && [scanner scanString:@"-"
intoString:NULL])
- title = [title substringFromIndex:[scanner scanLocation]];
+ NSUInteger dashLoc = [title rangeOfString:@"-"].location;
+ if (dashLoc != NSNotFound && dashLoc > 0 && [title
rangeOfCharacterFromSet:[NSCharacterSet nonDecimalDigitCharacterSet] options:0
range:NSMakeRange(0, dashLoc)].location == NSNotFound)
+ title = [title substringFromIndex:dashLoc + 1];
if ([file hasPrefix:@"."]) {
} else if ([title length] == 0 || [title isEqualToString:@"-"]) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit