Squeaky Clean

in #italast month

using System;
using System.Reflection;
using System.Text;

public static class Identifier
{
public static string Clean(string identifier)
{
bool lastWasHyphen = false;
StringBuilder sb = new StringBuilder();
foreach(char c in identifier)
{
if(c == ' ')
{
sb.Append('_');
}
else if (char.IsControl(c))
{
sb.Append("CTRL");
}
else if (c == '-')
{
lastWasHyphen=true;
}
else if (Char.IsLetter(c) && ((c < '\u03ac') || (c > '\u03ce')))
{
if(lastWasHyphen)
{
char add = char.ToUpper(c);
sb.Append(add);
lastWasHyphen = false;
}
else sb.Append(c);
}
}
return sb.ToString();

}

}

Sort:  

Thank you, friend!
I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
image.png
please click it!
image.png
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)

The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.032
BTC 62705.03
ETH 3101.95
USDT 1.00
SBD 3.82