I'm having .ToString Problems

When I try to use .ToString, Unity gives me this error message: Cannot convert 'String' to 'int'. Why?

Here's my code so I don't have to edit it in:

newD1 = newD1.ToString();

Also: I have this line of code that compares the index of this array to a string. The value in the array and the variable are both strings. Yet...

if(monsters *==  loadEnemyNameToString) {*
*}*
*```*
*<p>That's giving me this error:</p>*
*<blockquote>*
 *<p>Cannot cast from source type to*
 *destination type.</p>*
*</blockquote>*
*<p>Would you be so kind as to help me again? This problem is giving me eternal frustration.</p>*
*<p>Oh, and here's what's in the array:</p>*
*```*
 *var monsters = fileContents.Split("-"[0]);*
*```*
*<p>Ah what the heck. Here's the entire function that's such a pain:</p>*
*```*
*function SearchLog () {*
 *var sr = new StreamReader(Application.dataPath + "/" + readFilePath);*
 *var fileContents = sr.ReadToEnd();*
 *sr.Close();*
 *var monsters = fileContents.Split("-"[0]);*
 *for (var i in monsters) {*
 _if(monsters *== loadEnemyName.ToString()) {*_
 _*var i2 = i + 1;*_
 _*var i3 = i + 2;*_
 _*var i4 = i + 3;*_
 _*var i5 = i + 4;*_ 
 <em>_newEnemyName = monsters*;*_</em>
 <em>_*var loadedEnemyHealth = monsters[i2];*_</em>
 <em>_*var loadedEnemyDefense = monsters[i3];*_</em>
 <em>_*var loadedD1 = monsters[i4];*_</em>
 <em>_*var loadedD2 = monsters [i5];*_</em>
 <em>_*newEnemyHealth = float.Parse(loadedEnemyHealth);*_</em>
 <em>_*newEnemyDefense = float.Parse(loadedEnemyDefense);*_</em>
 <em>_*newD1 = float.Parse(loadedD1);*_</em>
 <em>_*newD2 = float.Parse(loadedD2);*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
<em>_*}*_</em>
<em>_*```*_</em>
<em>_*<p>I'm sure there are much more elegant ways of doing it but I'm on my last bit of juice. At this point I'm just nailing technical looking stuff together. </p>*_</em>
<em>_*<p>What I'm doing is loading a file that contains monster attributes. I'm then trying to parse it and split up the file at the - to get an array that contains the name, then the attributes directly after it. What am I doing wrong?</p>*_</em>

.ToString() returns the value of that value in string format. so if newD1 is not a string then it can't equal a string so your code should look like this:

var newD1String : String;
newD1String = newD1.ToString();

the problem with your code is that your telling it to make newD1 into a string but the only way that would work is if newD1 was a string already.