Advertisement
CharcoStudios

Script Fixer para script sql de tarea 05

Mar 5th, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1.   class Program
  2.     {
  3.         static void Main( string[] args )
  4.         {
  5.             string[] lines = File.ReadAllLines( "BD05_CreaTablasTarea.sql" );
  6.  
  7.             StringBuilder sb = new StringBuilder();
  8.  
  9.             foreach ( string line in lines )
  10.             {
  11.                 sb.AppendLine( TransformDate( line ) );
  12.             }
  13.  
  14.             File.WriteAllText( "BD05_CreaTablasTareaFixed.sql", sb.ToString( ) );
  15.         }
  16.  
  17.         private static string TransformDate( string line )
  18.         {
  19.            return Regex.Replace( line, "([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})", TransformMatch );
  20.     }
  21.  
  22.         private static string TransformMatch( Match match )
  23.         {
  24.            return match.Result( "$2/$1/$3" );
  25.         }
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement