//      strange behaviour for probably all combining marks (macOS 12.4):
NSString *pintu = @"-ฺ";        //      HYPHEN-MINUS + THAI CHARACTER PHINTHU
        
//      ok
NSString *test1 = pintu;
[ self printTestString: test1 ];         
// prints:      length 2 0x2d 0xe3a “-ฺ” ok:     has prefix “-“ 
__NSCFConstantString ← __NSCFString

//      BAD
NSString *test2 = [ @"/some/path" stringByAppendingPathComponent: pintu 
].lastPathComponent;    
[ self printTestString: test2 ];        
//  prints:     length 2 0x2d 0xe3a “-ฺ” BAD: has no prefix "-" NSPathStore2 ← 
NSString


- (void)printTestString: (NSString *)testWord
{
        BOOL hasPre = [ testWord hasPrefix: @"-" ];
        NSLog(@"%s length %tu %#x %#x \"%@\" %s prefix \"-\" %@ ← 
%@",__FUNCTION__, 
                testWord.length, [testWord characterAtIndex: 0], [testWord 
characterAtIndex: 1], testWord,
                hasPre ? "ok:     has" : "BAD: has no",
                [testWord class], [testWord superclass] );
}

Why has test2 no prefix?

What am I doing wrong?

Gerriet.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to