2009-09-30 9 views
0

je dois obtenir juste le nom de cette url:Get nom de XSL URL

http://feedproxy.google.com/~r/TEDTalks_video/~5/XT8k_DqlzGc/KarenArmstrong_2009G.mp4 

donc je dois obtenir:

KarenArmstrong_2009G 

J'ai besoin du nom de fichier que je peux ajouter .jpg et une autre URL de base.

+0

Peut-on utiliser le javascript pour obtenir votre nom? - par exemple. http://stackoverflow.com/questions/511761/js-function-to-get-filename-from-url – Scozzard

+3

Dupliquer? http://stackoverflow.com/questions/1500067/xsl-mediacontent –

Répondre

0

Salut, vous pouvez utiliser ce code

private void button1_Click(object sender, EventArgs e) 
    { 
     System.Uri uri = new System.Uri(@"http://feedproxy.google.com/~r/TEDTalks_video/~5/XT8k_DqlzGc/KarenArmstrong_2009G.mp4"); 
     string filename = ""; 

     filename = System.IO.Path.GetFileName(uri.LocalPath); /// filename="KarenArmstrong_2009G.mp4" 
     filename = filename.Substring(0, filename.Length - 4);/// filename="KarenArmstrong_2009G" 
     MessageBox.Show(filename); 
    } 
Questions connexes