Skip to content

Instantly share code, notes, and snippets.

@VisualMelon
Created March 30, 2017 03:20
Show Gist options
  • Save VisualMelon/3b81d66632ea86ed658745da9eca76df to your computer and use it in GitHub Desktop.
Save VisualMelon/3b81d66632ea86ed658745da9eca76df to your computer and use it in GitHub Desktop.
stripcs
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