ふらっとC#,C♯,C#(初心者用) Part37at TECH
ふらっとC#,C♯,C#(初心者用) Part37 - 暇つぶし2ch584:デフォルトの名無しさん
09/02/17 15:05:13
>>582
パス名の文字列を正規表現で分解して年と月を別々に取り出す
あとは大小比較で絞込み

Regex r;
r = new Regex(@"(\d{4})(\d{2})\d{2}eventname", RegexOptions.IgnoreCase);
Match m;
m = r.Match(@"c:/photo/20080407eventname/photo.jpg");
if (m.Success) {
String year = m.Groups[1].Value;
String month = m.Groups[2].Value;
Console.WriteLine("{0}年{1}月", year, month);
}



次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch