C# - Code:
private string dividere_durch16(string s1)
{
if (s1 == "") s1 = "0,0";
if (s1.IndexOf(',') < 0) s1 = "0," + s1;
if (s1[s1.Length-1]==',') s1 = s1 + "0";
while (s1.Length < 3) s1 = "0" + s1;
string e = "0,";
string SRest = s1.Substring(0, s1.IndexOf(','));
int rest = Convert.ToInt16(SRest);
s1 = s1.Substring(1+s1.IndexOf(','));
int zif;
bool ok = true;
for (int i=0;i<s1.Length; i++)
{
char c = s1[i];
try { zif = Convert.ToInt16(" " + c); }
catch { zif = 0; e = "FEHLER"; i= s1.Length; ok = false; }
if (ok)
{
int wert = rest*10 + zif;
int neuzif = wert / 16;
rest = wert - neuzif * 16;
if (ok) e = e + neuzif.ToString();
}
if (i == s1.Length - 1)
{
if (i<500)
if (rest != 0) s1 = s1 + "0";
}
}
return e;
}