Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public void setUrl(string url)
{

}


in my above url i am getting below path.
\\abc\File\CMS\2013\3\6\Scan\ISTQB f Syllabus.pdf


based on this i have check whether the url contains .pdf are not in next step. how can i write the condition for this...

please send me any suggestions
Posted
Comments
ZurdoDev 7-Mar-13 7:05am    
If it is a string, just use str.EndsWith(".pdf")

1 solution

*ryanb is right.
Use following code format:
C#
string url = "/temp/temp.pdf";
           if (url.EndsWith(".pdf"))
               Console.WriteLine("It is a Pdf file.");
           else
               Console.WriteLine("Not pdf file.");
 
Share this answer
 
v2
Comments
kanna443 7-Mar-13 8:27am    
Thank you giri
giri001 8-Mar-13 0:12am    
you are most welcome Kanna.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900