Created
March 30, 2017 03:20
-
-
Save VisualMelon/3b81d66632ea86ed658745da9eca76df to your computer and use it in GitHub Desktop.
stripcs
This file contains 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
function stripcs { | |
$acc = ""; | |
foreach($l in $input) { | |
$k = $l; | |
$i = $k.IndexOf("//"); | |
if ($k.Contains("~lcom~")) { | |
$i = $k.LastIndexOf("//"); | |
} | |
if ($i -gt -1) { | |
$k = $k.SubString(0, $i); | |
} | |
$k = $k.Trim(); | |
if ($k.EndsWith("else") -or $l.Contains("~space~")) { | |
$k += " "; | |
} | |
$acc += $k; | |
} | |
while ($acc.Contains("/*")) { | |
$acc = $acc.Remove($acc.IndexOf("/*"), $acc.IndexOf("*/") - $acc.IndexOf("/*") + 2); | |
} | |
$acc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment