实际遇到的问题是 单号15001订单的15001-A自动生成15001-B,15001-C....

//说明:以15001-A为基准生成15001-B
string maxno ="15001-A";
//1.把订单号和后缀分隔开
string[] strmax = maxno.Split('-');//以‘-’分割字符串,把150001和A分开
//2.转换ASCII码值需要字符串为char型,转换之
char sort = (char)strmax[1][0];//strmax[1]为数组第2个元素,strmax[1][0]为数组第2个元素的第一个字符
//3.转换为ASCII对应的数字
 int ascii = (int)sort;//字母A转换为ASCII值65
//4.序号+1
 int ascii2 = ascii + 1;//序号加1,为66
//5.转换回字母
string sort2 = ((char)ascii2).ToString(); //再转换为字母B
//6.返回拼接后的字符串15001-B
return strmax[0] + "-" + sort2.ToString();

 

相关文章:

  • 2021-07-31
  • 2022-01-13
  • 2021-09-29
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2021-07-26
相关资源
相似解决方案