Created
December 12, 2012 21:34
-
-
Save g0t4/4271829 to your computer and use it in GitHub Desktop.
Why manually replace crap over and over, why not write code to do it if it saves time :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void METHOD_SCENARIO_EXPECTATION() | |
{ | |
var path = @"..\..\..\View.spark"; | |
var code = File.ReadAllLines(path); | |
for (int lineNumber = 0; lineNumber < code.Length; lineNumber++) | |
{ | |
var line = code[lineNumber]; | |
var classControlLabel = "class=\"control-label\""; | |
if(line.Contains(classControlLabel)) | |
{ | |
if(code[lineNumber + 1].Contains("Attr(\"required") || code[lineNumber + 2].Contains("Attr(\"required")) | |
{ | |
code[lineNumber] = code[lineNumber].Replace(classControlLabel, "class=\"control-label required\""); | |
} | |
} | |
} | |
File.WriteAllLines(path, code); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment