Hello, new challenge:
I have a list / NSArray containing either
missing value /
or
real / __NSCFNumber
I’d like to copy this array to the clipboard / pasteboard, so I can paste it to an other application (like Microsoft® Excelâ„¢): real values (or blank lines) separated by a character.
In ASOC I did so:
set myCopy to {}
repeat with i from 1 to count of myArray
if item i of myArray is not missing value then
set myCopy to (myCopy & (item i of myArray) as string) & return
else
set myCopy to myCopy & return
end if
end repeat
set the clipboard to myCopy
and it worked perfectly. Now for Objective-C.
The problem is, if I use this:
I get, if the value is a number :
and of course if it’s null :
I read the docs and tried something else:
BOOL OK = [pasteboard setData:[myArray valueForKey:] forType: @“RTF”];
Bang.
Ok, and now? Could I create a NSValueTransformer, pseudocode:
if (item is a number) then
return a number +
else
return
endif
. or copy this array to a copy array, like in ASOC? Or use an other method?
Thanks for any answer!