• 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. Help: Searching part of string in list

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 144
  • Views 18036
  • 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

Help: Searching part of string in list

frasheed
frasheed over 11 years ago

 Hey,

Can anyone give me hint to serach part of string in list.

Example:

partName = "newStar"

fullNames = '("oldStarwork" "newStarWork" "loadStar" "halfStarwork")

if  Icheck it with member(partName fullNames) then will return nil but I want "newStarWork" as answer, I read the documenattion there is only member and memq functions are deifned for seraching lists . I looke the function recmatchp but its jist for symbol or strings and I have list (fullNames)

  • Cancel
Parents
  • theopaone
    theopaone over 11 years ago

        case(instTerm~>name

          (rexMatchp("g" instTerm~>name)

            dbSetq(instTerm "G" fix)

           )

           ); case

    Case is the wrong function to use, try cond. Case evaluates its first argument and then checks for the block designated by the matched string/integer.

    Cond executes each condition (like an if/then/elif/else in other languages) and executes the block for the first condition that returns true.

       cond(

          (rexMatchp("g" instTerm~>name)

    ;; Fix the g terminals

            dbSetq(instTerm "G" fix)

           )

     

          (rexMatchp("s" instTerm~>name)

    ;; fix the s terminals

            dbSetq(instTerm "S" fix)

           )

           ); cond

    And you might want to better qualify your search, what begins with "g" is "^g"

    Ted

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • theopaone
    theopaone over 11 years ago

        case(instTerm~>name

          (rexMatchp("g" instTerm~>name)

            dbSetq(instTerm "G" fix)

           )

           ); case

    Case is the wrong function to use, try cond. Case evaluates its first argument and then checks for the block designated by the matched string/integer.

    Cond executes each condition (like an if/then/elif/else in other languages) and executes the block for the first condition that returns true.

       cond(

          (rexMatchp("g" instTerm~>name)

    ;; Fix the g terminals

            dbSetq(instTerm "G" fix)

           )

     

          (rexMatchp("s" instTerm~>name)

    ;; fix the s terminals

            dbSetq(instTerm "S" fix)

           )

           ); cond

    And you might want to better qualify your search, what begins with "g" is "^g"

    Ted

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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