- Home /
Answer by Cynikal · Sep 13, 2016 at 03:38 PM
myTempString = "$250";
myTempString = myTempString.Replace("$", "");
Answer by DavidWatts · Sep 13, 2016 at 03:05 AM
You can use float.Parse( string s ) to convert to a float or if you don't know if the string is definitely a number then you can use float.TryParse( string s, out float result ) which returns true if it can convert. Not sure if is works if there is a $ at the end but i think it should
Answer by ionside · Sep 13, 2016 at 03:03 AM
You could try
float number = Single.Parse(value);
using System;
float number = Single.Parse("-87.44");
Debug.Log(number);
returns: -87.44
If you want to remove symbols from the end like $ you should remove them by using Remove.String(Int32) <- Int32 = the number of characters to remove from the end.
Your answer
Follow this Question
Related Questions
Can I create a list with an int/float and a string? C# 2 Answers
Convert a char to int / float 2 Answers
GUI.Label shows volume from a slider 3 Answers
Converting a string to an int 2 Answers