惊叹号系列#1:从字符串末尾删除感叹号【难度:0级】:
答案1:
public class Kata
{
public static string Remove(string s)
{
return s.EndsWith("!") ? s.Remove(s.Length-1) : s;
}
}
答案2:
public class Kata
{
public static string Remove(string s)
{
return (s.EndsWith("!")) ? s.Remove(s.Length-1) : s;
}
}
答案3:
using System.Text.RegularExpressions;
public class Kata
{
public static string Remove(string s)
=> new Regex("!$").Replace(s,"");
}
答案4:
public class Kata
{
public static string Remove(