using System;
namespace Common.Helper.StringText
{
///
/// 相关码的生成
///
public class CodeHelper
{
///
///获取文本数字码
///
/// 需要转换的文本
/// 需要码长度
///
public string GetCode(string code, int length)
{
code = PinYinHelper.GetFirstPinyin(code);
var random = new Random();
var numberLength = length - code.Length;
code += random.Next(Convert.ToInt32(Math.Pow(10, numberLength)),Convert.ToInt32(Math.Pow(10, numberLength + 1)));
return code;
}
}
}