+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 25
  1. #1
    Senior Member
    Discipline
    Mechanical
    Using
    Plant 3D not applicable
    Join Date
    Feb 2018
    Posts
    123

    Embarrassed Include " when using STRCAT

    Registered forum members do not see this ad.

    Dear coders


    I am trying to include " when using strcat
    Afaik you need to use \ or / in combinatiuon with extra " to get "something here" when using strcat


    So I want to do this


    (strcat "sometext" "" EXTRATEXT"" )


    As you can see the EXTRATEXT needs to be in quotes
    I tried
    (strcat "sometext" "\" EXTRATEXT""\ )
    but also
    (strcat "sometext" \"" EXTRATEXT"\" )


    and a few other but none of them works
    How can I strcat something that needs to stay in quotes?

  2. #2
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    943

    Default

    to get a " you have to use "\""

  3. #3
    Senior Member
    Discipline
    Mechanical
    Using
    Plant 3D not applicable
    Join Date
    Feb 2018
    Posts
    123

    Default

    THNX M8 I just forgot the extra "

  4. #4
    Senior Member
    Discipline
    Mechanical
    Using
    Plant 3D not applicable
    Join Date
    Feb 2018
    Posts
    123

    Default

    RLX
    What the hell am I doing wrong


    (strcat "sometext" "\"" EXTRATEXT"\"" )
    ; error: bad argument type: stringp nil




    _$ (strcat "sometext" "\"" EXTRATEXT""\" )
    ("_> ")
    ; error: bad argument type: stringp nil
    _$

  5. #5
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 7 Pro x64
    Computer:
    HP ZBook 17
    CPU:
    i7-4810MQ @ 2.80 GHZ
    RAM:
    16GB
    Graphics:
    Nvidia Quadro K4100M
    Primary Storage:
    256GB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    (2) HP 23"
    Discipline
    Civil
    rkmcswain's Discipline Details
    Discipline
    Civil
    Details
    CAD Manager
    Using
    Civil 3D 2017
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,511

    Default

    You could also do it like this

    Code:
    (strcat "sometext " (chr 34)  "EXTRATEXT" (chr 34))
    R.K. McSwain
    CAD Panacea | twitter

  6. #6
    Senior Member
    Discipline
    Mechanical
    Using
    Plant 3D not applicable
    Join Date
    Feb 2018
    Posts
    123

    Default

    Well i think i need some to use at my pc coz i am getting wicked results


    $ (strcat "sometext " (chr 34) "EXTRATEXT" (chr 34))
    "sometext \"EXTRATEXT\""


    What in the world is the \ doing up there?

  7. #7
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    803

    Default

    Quote Originally Posted by DGRL View Post
    RLX
    What the hell am I doing wrong


    (strcat "sometext" "\"" EXTRATEXT"\"" )
    ; error: bad argument type: stringp nil




    _$ (strcat "sometext" "\"" EXTRATEXT""\" )
    ("_> ")
    ; error: bad argument type: stringp nil
    _$
    See if this turns on a light bulb:
    Code:
    (setq extratext "some more text")
    (strcat "sometext" "\"" extratext "\"")
    (setq extratext nil)
    (strcat "sometext" "\"" extratext "\"")

  8. #8
    Senior Member
    Discipline
    Mechanical
    Using
    Plant 3D not applicable
    Join Date
    Feb 2018
    Posts
    123

    Default

    RLX


    Light bulb is starting to give light but in the end it turns to be STRINGP NIL


    _$ (setq extratext "some more text")
    "some more text"
    _$ (strcat "sometext" "\"" extratext "\"")
    "sometext\"some more text\""
    _$ (setq extratext nil)
    nil
    _$ (strcat "sometext" "\"" extratext "\"")
    ; error: bad argument type: stringp nil
    _$


    I am getting confused by this

  9. #9
    Senior Member
    Discipline
    Mechanical
    Using
    Plant 3D not applicable
    Join Date
    Feb 2018
    Posts
    123

    Default

    READING CODE IS IMPORTANT


    And tricking me is nasty LOL

  10. #10
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    803

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by DGRL View Post
    READING CODE IS IMPORTANT


    And tricking me is nasty LOL
    I'm not tricking you, I'm trying to get you to see what causes that error.

Similar Threads

  1. HELP to include "AcDbAlignedDimension" code for a "Dimension deleting" LISP
    By vernonlee in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 10th Apr 2015, 04:03 pm
  2. Replies: 0
    Last Post: 19th Nov 2013, 11:06 pm
  3. Replies: 7
    Last Post: 28th Sep 2010, 06:35 am
  4. (read (strcat "(" "1.5X250X600" ")"))
    By muthu123 in forum AutoLISP, Visual LISP & DCL
    Replies: 9
    Last Post: 10th Jul 2010, 01:05 pm
  5. (read (strcat "(" "TUBE150X150X4.5 20.2" ")"))
    By muthu123 in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 21st Jun 2010, 03:40 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts