• 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 convert integer to string?

Stats

  • Locked Locked
  • Replies 18
  • Subscribers 148
  • Views 40692
  • 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 convert integer to string?

latha
latha over 15 years ago

 Hi,

Can anybody let me know skill the function how to convert integer to string?

Ex: a=123 (integer)

I need

a="123" (string)

 

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 15 years ago
    sprintf(a "%d" a)
    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • babji
    babji over 15 years ago

     pcExprToString should work as well.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 15 years ago

     Hi,

    I think that Andrew's answer is the way to go, use sprintf().  You can perform further processing using the cdfFormatFloatString() function too:

    
      a = 123
      => 123
      formatted_a = cdfFormatFloatString( sprintf(nil "%d" a) "K")
      => "0.123K"
    

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • gheryiesan
    gheryiesan over 15 years ago

     oh..its really works well..

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • pvvikas
    pvvikas over 15 years ago
    Thank you so much Lawrence. This is exactly what I wanted. I needed to label output of a decoder as "row0", "row1" ..etc. Thanks Vikas
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Peach99
    Peach99 over 15 years ago

    Another question: How can I convert string to integer like this: "pmos"  to  pmos ???

    Regards

    Daniel Pietsch

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

    Daniel,

    Sorry, that doesn't make sense. "pmos" is a string, but pmos is not an integer. What are you actually trying to do? I could tell you how to convert a string to a symbol, but I'm not sure that's what  you actually want?

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Peach99
    Peach99 over 15 years ago

    I know that my statemant was wrong and I have found the correct function (stringToSymbol) I think! Thank you all the same!

    Regards

    Daniel Pietsch

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • DonWP9
    DonWP9 over 12 years ago

    Hi Andrew,

    How do you convert a string to a symbol or w_windowId?  I am using Ocean and want to make the w_windowId variable in the hardCopy command from strings I created. This way I can change the windowId with my program based on other variables.  I do not see the stringToSymbol function as described by another user.

     var = "window1"

    convertering steps to make "window1" to window1 (symbol or windowId)

    HardCopy(window1)

    Thanks for your help.

    Don

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 12 years ago

    Hi Don,

    The stringToSymbol function is a core SKILL function, so it is available in OCEAN.  You could also choose to use concat() for converting a string to a symbol - concat does not complain if you pass it either a string or a symbol, so it may be a little more flexible than stringToSymbol, depending on your usage of the function.

    In your post you mention "window1" - I'm used to seeing window id's like window:5 but perhaps yours is different because it is a waveform window?  However, if you have a window id like window:5 you can use the window function to return such an id, e.g.

    
    window(5)
    => window:5
    

    I hope this helps!
    Best regards,
    Lawrence.

    • 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