Home > Community > Forums > Custom IC SKILL > Trimming a string in SKILL

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Trimming a string in SKILL 

Last post Tue, Jan 23 2007 3:08 AM by archive. 5 replies.
Started by archive 23 Jan 2007 03:08 AM. Topic has 5 replies and 2513 views
Page 1 of 1 (6 items)
Sort Posts:
  • Tue, Jan 23 2007 3:08 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,910
    Trimming a string in SKILL Reply

    Could you please let me know if there is any way to trim a string in SKILL?
     
    e.g.
    Given string is ABCDEFG, MNOPEFG, IJKLEFG, WXYZEFG
     
    I want ABCD, MNOP, IJKL, WXYZ and trim out EFG from the above.
     
    Any suggestions...............


    Originally posted in cdnusers.org by vj
    • Post Points: 0
  • Tue, Jan 23 2007 3:20 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,910
    RE: Trimming a string in SKILL Reply

    It's not clear to me what the criterion is for trimming the string.

    My guess is that you want to do something like this:

    rexCompile("EFG$") ; pattern meaning EFG at end of string ($ means end of string)
    rexReplace("ABCDEFG" "" 1) ; replace first occurrence of pattern with blank.

    Essentially, the rex functions are regular expressions.

    Alternatively, if criterion is positional (the first four characters), then it
    would be:

    substring("ABCDEFG" 1 4)

    Regards,

    Andrew.


    Originally posted in cdnusers.org by adbeckett
    • Post Points: 0
  • Tue, Jan 23 2007 3:44 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,910
    RE: Trimming a string in SKILL Reply

    Thanks Andrew!

    Actually, the need is like this:

    I've a big design, the leaf cells of which are pointing to some standard library. I want to change the leaf cells to new standard library. The cell names of the old library are ABCD1T10. The cell names of the new library are ABCD.
    Is there any existing SKILL routing which changes the library name and cell name?

    The ABCD in the above can be of any number of characters and not necessarily equal to four characters. However, the 1T10 will remain constant.

    Any suggestions?????


    Originally posted in cdnusers.org by vj
    • Post Points: 0
  • Tue, Jan 23 2007 4:15 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,910
    RE: Trimming a string in SKILL Reply

    Well, the substitution in that case can be done exactly as I described in my previous example - use rexCompile("1T10$") to compile the pattern, and then rexReplace(cellName "" 1) to get the new cellname.

    If you have a cellView which has instances from the original library, with the original names, then you'll need to do something like this (this is untested, off-the-top-of-my-head code, just to illustrate the approach)

    ; expects variables cv to be current cellView, origLibName the name
    ; of the original library, newLibName the new library
    rexCompile("1T10$")
    foreach(instHeader cv~>instHeaders
    when(instHeader~>libName==origLibName && rexExecute(instHeader~>cellName)
    newCellName=rexReplace(instHeader~>cellName "" 1)
    dbSetInstHeaderMasterName(instHeader newLibName newCellName instHeader~>viewName)
    )
    )

    Regards,

    Andrew.


    Originally posted in cdnusers.org by adbeckett
    • Post Points: 0
  • Tue, Jan 23 2007 4:16 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,910
    RE: Trimming a string in SKILL Reply

    Sorry, the indentation got swallowed in my post - apologies for the badly formatted SKILL code.

    Regards,

    Andrew.


    Originally posted in cdnusers.org by adbeckett
    • Post Points: 0
  • Wed, Jan 24 2007 2:20 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,910
    RE: Trimming a string in SKILL Reply

    Thanx Andrew!!!!!!!

    :-)


    Originally posted in cdnusers.org by vj
    • Post Points: 0
Page 1 of 1 (6 items)
Sort Posts:
Started by archive at 23 Jan 2007 03:08 AM. Topic has 5 replies.