SPLIT

Home Forums General discussions SPLIT

This topic contains 4 replies, has 4 voices, and was last updated by  Lingwisyer GC 1 month, 4 weeks ago.

  • Author
    Posts
  • #4674

    David Seabury
    Participant

    I can not figure out how to split the following
    “#4 Rebar”. I can not split the pound sign form
    the number. Any insights would be helpful.

    Thanks

    David

  • #4675

    David Shorter
    Participant

    here you go
    !!!!!2D script
    !!=======================
    string=“#4 Rebar”
    number=strlen(string)
    text2 0,0,number
    reducedString=STRSUB(string, 2,number-2)
    text2 0,-.5, reducedString
    !!=======================
    number = 9
    reducedString = 4 Rebar

    this is one way but there per others
    Hope this helps
    David

    Attachments:
  • #4677

    David Seabury
    Participant

    David

    Thanks for the reply, I have no idea what you did there
    but I will look the GDL guide and see what I can learn.
    I was trying to use SPLIT and got no where.

    Thanks Again

    David

  • #4679

    Péter Baksa
    Participant

    SPLIT can only process numbers delimited with whitespace.

    Péter Baksa
    Software Engineer, Library Team
    GRAPHISOFT SE

  • #18203

    Lingwisyer GC
    Participant

    David’s code basically figures out where the # is then prints out “number – 2″ characters after this location. Number being the length of the calculated string. In the example only the opening ” is required to indicate that it is not a parameter.

    Ling.

    AC18-22 AUS 6021
    Self-taught, bend it till it breaks.
    Win7 | E5620 x 2 | 24GB | K2200

You must be logged in to reply to this topic.