• 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 double quotes from start and end of a string...

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 144
  • Views 11545
  • 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 double quotes from start and end of a string and add double quote inside at the same time

mvij
mvij over 2 years ago

Hi,

I need to create the following string and need some help with getting it done.

string1=strcat("list" " " "Connection1" " " "100" " " "'center" " " "'string" " " "t")
"list Connection1 100 'center 'string t"

string1_final needs to look like the following
string1_final = list "Connection1" 100 'center 'string t

Thank you,
Mvij

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago

    Mvij,

    string1=strcat("list" " \"" "Connection1" "\" " "100" " " "'center" " " "'string" " " "t")

    which produces:

    "list \"Connection1\" 100 'center 'string t"

    Now, to get to the question in your post's title. There are no double quotes at the beginning and the end of this string, nor are the backslashes in the string either. What you are seeing is the print representation of the string - i.e. what is displayed to you in the CIW when you look at a variable or the return value of a function. For strings, this is the same as the input syntax of the string - so you can directly take the print representation and use it to create a new literal string.

    This is clear if you print the string using printf:

    printf("%s\n" string1)

    which outputs:

    list "Connection1" 100 'center 'string t

    which is what you want. 

    I will ask a follow-on question though. You appear to be trying to generate a string that looks like SKILL code in some sort of fashion. What are you going to do with this string? It looks to me as if you might be approaching some problem in a rather indirect or inefficient way, but this is mere guesswork on my part.

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mvij
    mvij over 2 years ago in reply to Andrew Beckett

    Thank you Andrew.
    I am trying to generate a dynamic header list for hiCreateReportField and not looking at printing it.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to mvij

    It doesn't matter whether you're printing it or not, the string still doesn't contain the outer quotation marks nor the backslash.

    Why don't you just create a list rather than creating a string that looks like a SKILL function (without the parentheses)? In other words, why not do:

    list("Connection" 100 'centre 'string t)

    I don't really understand why you would want to create a string first.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mvij
    mvij over 2 years ago in reply to Andrew Beckett

    Thank you Andrew.
    This is what I am trying to do.
    I have  a list of strings
    list1=("Connection1" "Connection2")
    I intend to use this list as header in hiCreateReportField to make this dynamic.
    hiCreateReportfield(
                                 list("Connection1" 100 'centre 'string t)
                                 list("Connection2" 100 'centre 'string t)
                                 )

    In order to do the above, I need the create each header command first and then pass it as list to hiCreateReportField.
    Mvij

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to mvij

    list1=("Connection1" "Connection2")
    headers=foreach(mapcar headerName list1
      list(headerName 100 'center 'string t)
    )

    hiCreateReportField(
     ...
     ?headers headers
    )

    The foreach mapcar will transform the input list into a list of lists, which is what you want, I believe.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mvij
    mvij over 2 years ago in reply to Andrew Beckett

    True.
    But using list will take away ' from center and string and it would appear unbound variable in hiCreateReportField.
    Plus we would need list to appear as function so we would need to modify a bit list(concat(strcat("list")) headerName 100 ....)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to mvij
    mvij said:
    But using list will take away ' from center and string and it would appear unbound variable in hiCreateReportField.
    Plus we would need list to appear as function so we would need to modify a bit list(concat(strcat("list")) headerName 100 ....)

    What are you on about? This is complete nonsense (sorry if that's a bit harsh).

    Using list will not "take away ' from center". Why would you need to do list(concat(strcat("list")) ?

    You seem to be making some rather strange assumptions about how programming in SKILL works. Please try this complete example to see that it actually works:

    list1=list("Connection1" "Connection2")
    data=list(list("some" "value") list("other" "data"))
    
    headers=foreach(mapcar headerName list1
      list(headerName 100 'center 'string t)
    )
    
    hiCreateLayoutForm(
      'ExampleForm
      "Example Form"
      hiCreateFormLayout(
        'layout
        ?items list(
          hiCreateReportField(
    	?name 'generatedField
    	?headers headers
    	?choices data
          )
        )
      )
    )
    hiDisplayForm(ExampleForm)
    

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mvij
    mvij over 2 years ago in reply to Andrew Beckett

    Thank you Andrew.

    • 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