• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. how to remove duplicates in a string

Stats

  • Locked Locked
  • Replies 10
  • Subscribers 144
  • Views 16156
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to remove duplicates in a string

gharish
gharish over 11 years ago

Please tell me how to remove duplicates in a given string

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    You really need to provide a bit more detail. What do you mean by "duplicates"? Do you mean remove any character other than the first occurrence of that character? Do you mean remove adjacent repeated characters? Do you mean remove duplicate sequences of specified strings? Please clarify - this could mean many things, and so a clear description, ideally with examples, would help.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • gharish
    gharish over 11 years ago

     I have a string "ABBABAAB". here elements A and B are repeteated several times. I need unique elements only.If my string is "ABBABBAB" then my output string should be "AB"

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Using the function MyUnique shown in this post, you could use:

    buildString(MyUnique(parseString("ABBABAAB" "")) "")

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • tweeks
    tweeks over 11 years ago

    This also works:

    buildString(artUnique(parseString("ABBABAAB" "")) "")
    
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    artUnique is a private (and hence undocumented) SKILL function, so you should not use it as it is liable to be changed or even deleted without notice.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • tweeks
    tweeks over 11 years ago

    Are you sure it's private?  If it were called

    _artUnique()

    or

    artiUnique()

     

    then I would agree, it's obviously private, but I have found multiple (jolly useful) built-ins that appear to be public by their names, and yet remain curiously undocumented, e.g. getShellArgs(), push(), and pop().

    Sometimes an email to Cadence Support is all it takes to get them documented.  E.g., I saw to it that cons\*() and let\*() were documented.  

     

    SKILL also appears to contain a totally undocumented implementation of Scheme-style hygienic macros, and unwindProtect()!

     Edit: unwindProtect() is documented in IC616-ISR5.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    Yes, I'm sure it's private. I wouldn't have said so otherwise. I checked in our internal registry.

    I was involved in the team that set up the rules for SKILL function naming (probably about 15 years ago now) and so most things since then follow the rules. However, certain historical functions do not - and we weren't going to edit their names (and risk destabilizing the code).

    Occasionally there are implementations in core SKILL which are not ready yet, and so we choose not to document them and make them public until they are. unwindProtect is also documented in IC615 - so that's not one. Some of the others are historically there, but have never been chosen to be made public. Depending on the state of their implementation, that may change - but I don't see artUnique being one of those because it's a utility function owned by the ADE team, and if it was public it would make more sense for it to be in core SKILL.

    The general rule is that new public functions should have a clearly public name, and should be documented. So if it is not documented, it is not public (at least not yet if it is new), and should be avoided because it is liable to change.

    Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • tweeks
    tweeks over 11 years ago

    Andrew Beckett said:

    The general rule is that new public functions should have a clearly public name, and should be documented. So if it is not documented, it is not public (at least not yet if it is new), and should be avoided because it is liable to change.

    Thank you for the clear explanation, Andrew.

    Ironically, I found a private function for determining whether something is public:

    (In IC616-ISR5):

    _iliIsPublicFunc 'artUnique => nil
    _iliIsPublicFunc 'car => t
    _iliIsPublicFunc 'getShellArgs => nil
    _iliIsPublicFunc 'push => nil
    _iliIsPublicFunc 'pop => nil
    _iliIsPublicFunc 'techSetTechFileName => nil
    
     
    

    It is curious that techGetTechFileName() is public, but techSetTechFileName() isn't in IC616—
    especially since it was public in IC5141!

    > getVersion
    "@(#)$CDS: icfb.exe version 5.1.0 03/30/2009 07:18 (cicln04) $"
    > help techSetTechFileName
    Consulting cdsFinder database (may take a while) ...
     
    techSetTechFileName( 
    g_ID
    t_techfileName 
    ) 
    => t | nil
     
    Updates the techFile property of the specified library or cellview.
    This property is one of two that attach a library or cellview
    to a technology file.
    t
    
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    That private function to find out whether something is private or public uses information from the registry that we dump into the installation, and the primary use is for SKILL Lint (when the "Cadence functions" checkbox is chosen in SKILL Lint) to tell you whether functions are private or public.

    There are occasions when functions are retired. They are still "public" but we choose to stop documenting them (we have a "override" in our database for this purpose). In this case, the function is obsolete, and if you call it you will get:

    *WARNING* (TECH-2000021): techSetTechFileName is obsolete.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • tweeks
    tweeks over 11 years ago

    Thank you very much for explaining what _iliIsPublicFunc() is for, and about "obsolete" functions (I had no idea Cadence ever obsolesced anything!).

    Please let me know next time you are in Southern California so I can buy you a pint and learn more SKILL secrets!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information