Revision: 28903
          http://sourceforge.net/p/bibdesk/svn/28903
Author:   hofman
Date:     2024-05-14 14:16:18 +0000 (Tue, 14 May 2024)
Log Message:
-----------
template keys for suffix of strings

Modified Paths:
--------------
    trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/bibdesk.texi
    trunk/bibdesk/NSString_BDSKExtensions.h
    trunk/bibdesk/NSString_BDSKExtensions.m

Modified: trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/bibdesk.texi
===================================================================
--- trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/bibdesk.texi 
2024-05-14 09:35:56 UTC (rev 28902)
+++ trunk/bibdesk/BibDesk.help/Contents/Resources/en.lproj/bibdesk.texi 
2024-05-14 14:16:18 UTC (rev 28903)
@@ -4545,6 +4545,12 @@
 @tab
 @item threeCharacterPrefix
 @tab
+@item oneCharacterSuffix
+@tab
+@item twoCharacterSuffix
+@tab
+@item threeCharacterSuffix
+@tab
 @end multitable
 
 @subheading Appending

Modified: trunk/bibdesk/NSString_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSString_BDSKExtensions.h     2024-05-14 09:35:56 UTC (rev 
28902)
+++ trunk/bibdesk/NSString_BDSKExtensions.h     2024-05-14 14:16:18 UTC (rev 
28903)
@@ -469,9 +469,14 @@
 @property (nonatomic, readonly) NSString 
*stringByRemovingSurroundingWhitespaceAndNewlines;
 @property (nonatomic, readonly) NSString 
*stringByCollapsingWhitespaceAndNewlines;
 @property (nonatomic, readonly) NSString 
*stringByCollapsingWhitespaceAndNewlinesAndRemovingSurroundingWhitespaceAndNewlines;
+
 @property (nonatomic, readonly) NSString *oneCharacterPrefix;
 @property (nonatomic, readonly) NSString *twoCharacterPrefix;
 @property (nonatomic, readonly) NSString *threeCharacterPrefix;
+@property (nonatomic, readonly) NSString *oneCharacterSuffix;
+@property (nonatomic, readonly) NSString *twoCharacterSuffix;
+@property (nonatomic, readonly) NSString *threeCharacterSuffix;
+
 @property (nonatomic, readonly) NSString *fullyEncodeAsIURI;
 
 @property (nonatomic, readonly) NSData *sha1Signature;

Modified: trunk/bibdesk/NSString_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSString_BDSKExtensions.m     2024-05-14 09:35:56 UTC (rev 
28902)
+++ trunk/bibdesk/NSString_BDSKExtensions.m     2024-05-14 14:16:18 UTC (rev 
28903)
@@ -1351,17 +1351,29 @@
 }
 
 - (NSString *)oneCharacterPrefix {
-    return [self substringToIndex:MIN (1, [self length])];
+    return [self substringToIndex:MIN(1, [self length])];
 }
 
 - (NSString *)twoCharacterPrefix {
-    return [self substringToIndex:MIN (2, [self length])];
+    return [self substringToIndex:MIN(2, [self length])];
 }
 
 - (NSString *)threeCharacterPrefix {
-    return [self substringToIndex:MIN (3, [self length])];
+    return [self substringToIndex:MIN(3, [self length])];
 }
 
+- (NSString *)oneCharacterSuffix {
+    return [self substringFromIndex:MAX(1, [self length]) - 1];
+}
+
+- (NSString *)twoCharacterSuffix {
+    return [self substringFromIndex:MAX(2, [self length]) - 2];
+}
+
+- (NSString *)threeCharacterSuffix {
+    return [self substringFromIndex:MAX(3, [self length]) - 3];
+}
+
 // This method is copied and modified from NSString-OFStringExtensions.m
 - (NSString *)fullyEncodeAsIURI {
     static const char hexDigits[16] = {'0', '1', '2', '3', '4', '5', '6', '7', 
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to