I am new to C# and I have a question regarding what the {} do within the Write & WriteLine methods... If you look at the code below, this line in particular is confusing me System.Console.Write("{0,24}", s); - what does the {0,24} do here???
Thanks in advance!!!
Nicole
class TestRegularExpressions
{
static void Main()
{
string[] sentences =
{
"cow over the moon",
"Betsy the Cow",
"cowering in the corner",
"no match here"
};
string sPattern = "cow";
foreach (string s in sentences)
{
System.Console.Write("{0,24}", s);
if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
System.Console.WriteLine(" (match for '{0}' found)", sPattern);
}
else
{
System.Console.WriteLine();
}
}
}
}
Thanks in advance!!!
Nicole
class TestRegularExpressions
{
static void Main()
{
string[] sentences =
{
"cow over the moon",
"Betsy the Cow",
"cowering in the corner",
"no match here"
};
string sPattern = "cow";
foreach (string s in sentences)
{
System.Console.Write("{0,24}", s);
if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
System.Console.WriteLine(" (match for '{0}' found)", sPattern);
}
else
{
System.Console.WriteLine();
}
}
}
}