This is my code:
string Unreadz = "0";
while (true)
{
Unreadz = CheckMail();
if (!Unreadz.Equals("0")) port.Write("m");
else port.Write("n");
}
If Unreadz is less than 10, I want to add a 0 before it, before port.write.
This is what I have tried:
if (Unreadz < 10) port.Write("0" + Unreadz);
else port.Write("" + Unreadz);
but it doesn’t work because Unreadz is a string.
If its guaranteed that the return value will be an integer represented as string, then you can convert it to a number and then perform comparison.