Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.


string formatting in FS?

adamohernadamohern Member, OS Professional Posts: 216 PRO
edited April 2016 in FeatureScript
I'm used to Python's string formatting, where I can insert variables into a longer string and the result is concatenated automatically. Is there anything similar in FS? In the example below, look how much more readable the Python example is.


"Hello, my name is %s and I like to eat %s on %s." % (name, food, day_of_week)

"Hello, my name is {} and I like to eat {} on {}.".format(name, food, day_of_week)
vs FeatureScript (AFAIK):

"Hello, my name is " ~ name ~ " and I like to eat " ~ food ~ " on " ~ day_of_week ~ "."


  • Options
    kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    edited April 2016
    There isn't right now. I suspect at some point the FS solution for this will look a lot like sprintf in C... something like:
    format("%d plus %d is %d", a, b, a+b);
    This is NOT available today – your quotes and twiddles solution is currently the only way to go.
Sign In or Register to comment.