|
Western Florida
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,174 since Jan 2013
Thanks Given: 57,989
Thanks Received: 26,406
|
A few ways; all just C#, not specific to Ninja:
double doubleVar;
string stringVar = "12";
doubleVar = Convert.ToDouble(stringVar);
See Convert.ToDouble Method (String) (System)
(This is what I would use if I knew the string would only contain numbers)
---------
Also
string stringVar = "12";
double doubleVar;
doubleVar = Double.Parse(stringVar);
See Double.Parse Method (String) (System)
-------
Also
string stringVar = "12";
double doubleVar;
if (Double.TryParse(stringVar, out doubleVar))
{
// If successful, variable doubleVar will contain the converted double
// Do something with doubleVar here
}
else
{
// If not successful (maybe the string didn't have numbers in it, handle it here
}
See Double.TryParse Method (String, Double) (System)
When one door closes, another opens.
-- Cervantes, Don Quixote |
|