bonjour a tous
je souhaite simplifier ce gout de code : en utilisant simplement une expression réguliere
merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 string versionVe = string.Empty; string versionVi = string.Empty; string patternVE = @"VE(?<versionVe>\d{2})"; string patternVI = @"VI(?<versionVi>\d{2})"; string fileName = "D:\\MDT_REFERENTIEL\\Systeme d'exploitation\\Socle\\VE01\\VI08\\toto.wim"; Match match1 = new Regex(patternVE).Match(fileName); versionVe = match1.Groups["versionVe"].Value; Match match2 = new Regex(patternVI).Match(fileName); versionVi = match2.Groups["versionVi"].Value; socleName = Path.GetFileName(fileName);
Partager