Skip to content

Commit

Permalink
Add toString to NSString
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaTheFoxgirl committed Nov 27, 2024
1 parent cd323c7 commit c606bbc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion source/foundation/nsstring.d
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,12 @@ public:
*/
NSString init(const(char)* str) @selector("initWithUTF8String:");

/**
Returns an initialized NSString object containing a given number of
bytes from a given buffer of bytes interpreted in a given encoding.
*/
NSString init(void* bytes, NSUInteger len, NSStringEncoding encoding) @selector("initWithBytes:length:encoding:");

/**
A lowercase representation of the string.
*/
Expand Down Expand Up @@ -610,7 +616,7 @@ public:
Returns a Boolean value that indicates whether a given string is equal
to the receiver using a literal Unicode-based comparison.
*/
bool opEquals(inout(NSString) other) inout @selector("isEqualToString:");
bool isEqual(inout(NSString) other) inout @selector("isEqualToString:");

/**
Encodes the receiver using a given archiver.
Expand All @@ -626,6 +632,14 @@ public:
Returns a new instance that’s a copy of the receiver.
*/
id copyWithZone(NSZone* zone) @selector("copyWithZone:");

/**
Converts to a D string.
*/
extern(D)
final string toString() {
return cast(string)ptr[0..length];
}
}

/**
Expand Down

0 comments on commit c606bbc

Please sign in to comment.