transform.position output looks weird

Hey there,

I have encountered a problem when writing the transform.position float to a file.
I log the position of the player character in one file and display the current position in another file.

For the log script I used a string to write all Information into one line:

void Update() 
	{
		if (!is_logging || Time.time < timeToLog || !PositionLogging) return;
		timeToLog = Time.time + deltaTime;
		
		fs.Write(LoggTransform(playerobject));
		//foreach(ILoggable l in this.loggables) if(l.Logg()) fs.Write(l.ToLogg());
		fs.Write(Environment.NewLine);
	}
	
	private string LoggTransform (GameObject playerobject)
	{
		return String.Format("{0:0.0000}|{1:0.0000}|{2:0.0000}|",
		                     playerobject.transform.position.x,
		                     playerobject.transform.position.y,
		                     playerobject.transform.position.z
		                     );
	}

It works just fine and when I open the created file it looks like this:

When trying to display the current position I wrote another script, which uses the same transforming method but this time with two seperate Lines.

void Update() 
	{
		if (Time.time < timeToLog || !PositionLogging) return;
		timeToLog = Time.time + deltaTime;
    
		using (FileStream fs = new FileStream(@".\positionUpdate\grid.csv.", FileMode.Open, FileAccess.Write))
		using (StreamWriter sw = new StreamWriter(fs))
		{
			sw.WriteLine(Transform_x(playerobject));
			sw.WriteLine(Transform_z(playerobject));
		}

	}

	private string Transform_x (GameObject playerobject)
	{
		return String.Format("{0:0.00000}",
		                     playerobject.transform.position.x);
	}

	private string Transform_z (GameObject playerobject)
	{
		return String.Format("{0:0.00000}",
		                     playerobject.transform.position.z);
	}
}

This time however when I check the values inside the file, they’re all over the place. Basically it’s still the same sequence of numbers but the commas are all messed up:
50982-currentposition.jpg

I already tried displaying it as just the float and converting it to a decimal but that wouldn’t work either.

Can any of you guys help me out with this?

Thanks,
Lukas!

Please remember that Excel sucks big time when it comes to simple text interpretation. As mentioned from supernat a text editor will reveal the integrity (correctness) of the data.
I can recommend OpenOffice which always throws an import settings prompt including a live view of your ‘parsed’ data.