Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by mythraend · May 26, 2012 at 08:00 PM · stringintconvertlong

c# convert int to string

I'm new to C# and Unity and I can't figure out the syntax to convert a long or int number to a string in c#. Any help would be greatly appreciated.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
8
Best Answer

Answer by whydoidoit · May 26, 2012 at 08:05 PM

Just use yourIntVariable.ToString();

Everything in .NET has a .ToString();

If you need to convert back then it is int.Parse(yourString) etc.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mythraend · May 26, 2012 at 09:48 PM 0
Share

Thank you. That worked. I was tripped up by the parenthesis after the .tostring. Never came across anything like that in my web language / vb experience.

avatar image whydoidoit · May 26, 2012 at 09:50 PM 0
Share

No problem - one thing - you should put comments like this as a comment rather than an answer (that just confuses folk :) [Edit: this was an answer when I wrote this, honest :)]

Second thing, please mark the question as answered by clicking on the tick next to my answer above - that removes it from the list that is used to find questions that need attention. (And it keeps my accepted answer % looking better!)

Don't mark this one as the answer though - that is doubly confusing, mark the one I wrote for you.

avatar image mythraend · May 26, 2012 at 09:54 PM 0
Share

Ok, I'll make sure to make it a comment when I'm not answering for now on. Got it answer mark co$$anonymous$$g up.

avatar image whydoidoit · May 26, 2012 at 10:00 PM 0
Share

Welcome on board and best of luck with it. Be very aware that Unity Javascript ain't that much like browser Javascript. I sometimes think it's better just to bite the bullet and write C# - that way you $$anonymous$$NOW it's different ;) So keep the faith on that it's the right way to go...

avatar image RealSoftGames · Feb 18, 2015 at 11:39 AM 0
Share

i love you so much for making this so clear!!!!

avatar image
0

Answer by firemyst · Mar 24, 2014 at 08:07 AM

For anyone who's curious about the fastest way to convert an int to a string, you can read this webpage.

Basically it's a toss up between:

.ToString() Convert.ToString()

until you get to about 21 million conversions.

The code is there too if you want to run it on your own system.

Good luck!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Download a WWW int? Or convert? 1 Answer

int to string, weird string value? 1 Answer

convert string to int 0 Answers

Convert int to string 2 Answers

Array - Convert Object into Int 5 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges