Page 1 of 1

strange string behaviour

PostPosted: Thu Jul 29, 2010 6:46 am
by udo.killermann
Bernd,

when I run the following code:
Code: Select all
Dim myArr As Array

Event AwakeFromNib()
  myArr = Array("Hund", "com.apple.CrashReporter", "Maus")
  Log(myArr)
End Event


it gives this log output:
Code: Select all
2010-07-29 07:40:51.264 stringOrOther[2778:903] (
    Hund,
    "com.apple.CrashReporter",
    Maus
)


Each String is presented as normal, except the one with "." in it. This one is quoted.

I want to use a similar construct to call a shell command with arguments via Bash, but end up with an error, because the called command doesn't recognize this string. For now I am going with a shell script that carries out the action and is called from within my OB app.

Is this behaviour by design of the runtime or a glitch?

Regards
Udo

Re: strange string behaviour

PostPosted: Thu Jul 29, 2010 11:11 am
by berndnoetscher
Hi Udo,

this is related to cocoa internals.

It looks like it is something related to quoting of nslog and nsalert. Both add " to the string.
Try this. It looks different:

Code: Select all
Dim myArr As Array

Event AwakeFromNib()
  myArr = Array("Hund", "com.apple.CrashReporter", "Maus")
  Alert(myArr.Object(1))
End Event

Re: strange string behaviour

PostPosted: Thu Jul 29, 2010 7:30 pm
by udo.killermann
Bernd,

thanks for your comment.

Regards
Udo