Recent

Author Topic: (solved) how can i know a string type in cocoa?  (Read 163 times)

powerpcer

  • Jr. Member
  • **
  • Posts: 89
(solved) how can i know a string type in cocoa?
« on: September 30, 2022, 12:35:46 am »
some cocoa function's parameter is aString: id;
but this aString, maybe a NSString or NSAttributedString.
in SWIFT, i can doit like this
        if let attrStr = aString as? NSAttributedString {
           .....
        } else if let str = aString as? NSString {
            ....
        }
but how about do the same thing in FPC?


SOLUTION:
parameter: aString: id

if (aString.isKindOfClass(NSAttributedString.classClass)) then
« Last Edit: September 30, 2022, 06:26:18 am by powerpcer »

 

TinyPortal © 2005-2018