strange string behaviour

Coding Questions, IDE related or anything else

strange string behaviour

Postby udo.killermann » Thu Jul 29, 2010 6:46 am

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
--------------
MacBook (2GHz, 4 GByte) - Lion (10.7.3)
started Objective Basic coding in April 2010 - still enjoy it ;-)
udo.killermann
 
Posts: 247
Joined: Thu Apr 08, 2010 6:46 am
Location: Hannover, Germany

Re: strange string behaviour

Postby berndnoetscher » Thu Jul 29, 2010 11:11 am

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
berndnoetscher
Site Admin
 
Posts: 280
Joined: Fri Feb 20, 2009 11:58 am

Re: strange string behaviour

Postby udo.killermann » Thu Jul 29, 2010 7:30 pm

Bernd,

thanks for your comment.

Regards
Udo
--------------
MacBook (2GHz, 4 GByte) - Lion (10.7.3)
started Objective Basic coding in April 2010 - still enjoy it ;-)
udo.killermann
 
Posts: 247
Joined: Thu Apr 08, 2010 6:46 am
Location: Hannover, Germany


Return to Objective-Basic (Xcode 3)

Who is online

Users browsing this forum: No registered users and 0 guests

cron