Code Snippet posted by:
Gow.Net | Posted on: 7/6/2012 | Category:
C# Codes | Views: 528 | Status:
[Member] |
Points: 40
|
Alert Moderator
1.Method 1
string input = "www.dotnetfunda.com";
string[] arr = new string[] { ".net", ".com", ".in" };
// Loop through and test each string
foreach (string ss in arr)
{
if (input.EndsWith(ss))
{
A.WriteLine(ss);
}
}
2.Method 2
//condition using
string name="Gowthaman Vimal";
if (name.EndsWith("Vimal"))
{
A.WriteLine(name);//endwith "Vimal" true
}
else
{
A.WriteLine("i Can't find");
}
gowthaman8870226416