Unfortunately, you need to assume how many spaces a tab represents. You should set this to a fixed value (like the mentioned 4) or make it a user option.
The quickest way to do this is .Net is (I'm using C#):
var NewString = "This is a string with a Tab";
var TabLength = 4;
var TabSpace = new String(' ', TabLength);
NewString = NewString.Replace("\t", TabSpace);
You can then change the TabLength variable to anything you want, typically as mentioned previously, 4 space characters.
Tabs in all operating systems are the same length, 1 tab! What differs is the way software displays them, typically this is the equivalent width of 4 space characters and this also assumes that the display is using a fixed width font such as Courier New.
For example, my IDE of choice allows me to change the width of the tab character to a value that suits me.