Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //C#
- // test2 du C# sur OpenSim
- public void default_event_state_entry()
- {
- // tableau de int
- int[] intT = new int[] { 1, 2, 3, 4, 5 };
- // test d'une boucle foreach
- foreach( int i in intT )
- {
- llSay( 0, "Numero " + i );
- }
- // utilisation du Dictionary (inclus dans le framework)
- System.Collections.Generic.Dictionary<int, string> dc = new System.Collections.Generic.Dictionary<int, string>();
- // on ajoute quelques données dans notre dictionary
- dc.Add( 12, "hello" );
- dc.Add( 1, "hi" );
- dc.Add( 86, "o.o" );
- dc.Add( 666, "@.@" );
- // on affiche le contenu de dc avec un foreach
- foreach( System.Collections.Generic.KeyValuePair<int, string> kvp in dc )
- llSay( 0, "Key : " + kvp.Key + "; Value : " + kvp.Value );
- // visiblement les expressions regulieres sont egalement supportées, pourquoi s'en priver o.o
- System.Text.RegularExpressions.Regex rg = new System.Text.RegularExpressions.Regex( @"\w+" );
- // la chaine de caractères à tester avec notre regex
- string toast = "expressions regulieres supportees ?";
- // on lance la recherche qu'on récupère dans une collection de Match
- System.Text.RegularExpressions.MatchCollection mcs = rg.Matches( toast );
- // on affiche le résultat avec un foreach
- foreach( System.Text.RegularExpressions.Match mc in mcs )
- llSay( 0, "Found : " + mc.Groups[0].Value );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement