Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Michel http://michelc.wordpress.com/

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Capitalization

using System.Text.RegularExpressions;

public class MyClass {

	public static void Main() {
		string text = "the quick red fox jumped over the lazy brown DOG.";
		System.Console.WriteLine("text=[" + text + "]");
		string result = Regex.Replace(text, @"\w+", new MatchEvaluator(MyClass.CapText));
		System.Console.WriteLine("result=[" + result + "]");
		System.Console.ReadLine();	
	}

	static string CapText(Match m) {
		string temp = m.ToString();
		temp = char.ToUpper(temp[0]) + temp.Substring(1, temp.Length - 1).ToLower();
		return temp;
	}

}

http://windows.oreilly.com/news/csharp_0101.html

Reconnaitre un numéro de sécurité sociale

([12][0-9][0-9](0[1-9]|1[0-2])(0[1-9]|[13456789][0-9]|2[023456789AB])[0-9][0-9][0-9][0-9][0-9][0-9])([0-9][0-9])

cf http://u-blog.net/dda/note/11 pour les explications
(et reste à valider la clé de contrôle)
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS