TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Krushert on April 12, 2011, 04:04:29 PM

Title: Getting extra charcters when using RTOS
Post by: Krushert on April 12, 2011, 04:04:29 PM
So I started with some of Kerry's code (http://www.theswamp.org/index.php?topic=10317.msg131450#msg131450) and then realizing it is spitting out in real numbers and I need to convert to string form.  When I tried to do it I am getting extra characters.  Why???  If I remove the rtos, it retuns the real number in the correct form.

Quote
"3'-3 1/4\" "
_$

it should read 3'-3 1/4"

Code: [Select]
(SETQ DimEnt2  (CAR (ENTSEL "\nSelect Height Dimension :") )
         DimObj2  (VLAX-ENAME->VLA-OBJECT DimEnt2)
         Measurement2 (rtos (VLAX-GET DimObj2 'Measurement) 4 6)
)
Title: Re: Getting extra charcters when using RTOS
Post by: ronjonp on April 12, 2011, 04:11:03 PM
Try the two  :-) :

(alert "3'-3 1/4\"")

(alert "3'-3 1/4")
Title: Re: Getting extra charcters when using RTOS
Post by: Krushert on April 12, 2011, 04:19:31 PM
Okay?  :|   That is weird.

But I can see that I did not take it far enough.  I was just looking at what was being returned in watch window thinking that was what I was going to get.

Thank you.
Title: Re: Getting extra charcters when using RTOS
Post by: ronjonp on April 12, 2011, 04:25:03 PM
Okay?  :|   That is weird.

But I can see that I did not take it far enough.  I was just looking at what was being returned in watch window thinking that was what I was going to get.

Thank you.

No prob  :-)
Title: Re: Getting extra charcters when using RTOS
Post by: Lee Mac on April 12, 2011, 04:25:35 PM
Ask yourself: How does one express a quotation mark in a string without signifying the end of the string itself?

The same applies to the backslash - consider the following:

Code: [Select]
(alert "a\tb")
Code: [Select]
(alert "a\\tb")
Title: Re: Getting extra charcters when using RTOS
Post by: ronjonp on April 12, 2011, 04:30:21 PM
Or try (alert (chr 34))  :lol:
Title: Re: Getting extra charcters when using RTOS
Post by: Jeff H on April 12, 2011, 04:31:02 PM
Escape characters
http://en.wikipedia.org/wiki/Escape_character
Title: Re: Getting extra charcters when using RTOS
Post by: Krushert on April 12, 2011, 04:34:45 PM
Ask yourself: How does one express a quotation mark in a string without signifying the end of the string itself?

Oooooohhhhhh.  (http://i717.photobucket.com/albums/ww173/prestonjjrtr/Smileys/1lg019idea.gif)
Okay that explains it.  Thanks.