gpt4 book ai didi

c# - 如何对 ID 进行子字符串化?

转载 作者:行者123 更新时间:2023-11-30 14:36:55 26 4
gpt4 key购买 nike

我有一个ID这是LSHOE-UCT。我怎样才能对那些 ID 进行子字符串化和分隔,以便成为:

gender = "L"
Product = "Shoe"
Category = "UCT"

这是我的代码:

    private void assignProductCategory(string AcStockCategoryID)
{
//What should I insert?
string[] splitParameter = AcStockCategoryID.Split('-');

}

我需要将它们分开,对它们进行标识并从我的数据库插入到差异表中。这就是我遇到的主要问题

最佳答案

string[] s = AcStockCategoryID.Split('-');
string gender = s[0].Substring(0, 1);
string Product= s[0].Substring(1, s[0].Length - 1);
string Category = s[1];

关于c# - 如何对 ID 进行子字符串化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9929938/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com