SmartSQL/SmartSQL.Framework/Util/StringExtension.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
namespace SmartSQL.Framework.Util
{
public static class StringExtension
{
public static string CamelCaseName(this string str)
{
if (String.IsNullOrEmpty(str)) return str;
string[] words = Regex.Split(str, "[_\\-\\. ]");
return string.Join("", words.Select(FirstCharToUpper));
}
public static string LowerCamelCaseName(this string str)
{
if (String.IsNullOrEmpty(str)) return str;
string[] words = Regex.Split(str, "[_\\-\\. ]");
return string.Join("", words.Select(FirstCharToLower));
}
public static string FirstCharToLower(this string str)
{
if (String.IsNullOrEmpty(str) || str.Length == 0)
return str;
if (str.Length == 1) return str.ToLower();
return str.Substring(0, 1).ToLower() + str.Substring(1);
}
public static string FirstCharToUpper(this string str)
{
if (String.IsNullOrEmpty(str) || str.Length == 0)
return str;
if (str.Length == 1) return str.ToUpper();
return str.Substring(0, 1).ToUpper() + str.Substring(1);
}
/// <summary>
/// 处理非法字符路径
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string FilterIllegalDir(this string str)
{
if (string.IsNullOrEmpty(str))
{
return "";
}
if (str.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
str = string.Join(" ", str.Split(Path.GetInvalidFileNameChars()));
}
return str;
}
public static string ToEmpty(this string str)
{
if (String.IsNullOrEmpty(str) || str.Length == 0)
后面还有 13 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
