我需要更改以下数据
A320-ZL-522-01-1(2)
A320-ZL-531-01-1(1)
A320-ZL-531-01-1(2)
A320-ZL-531-01-1(1)
A320-ZL-531-01-1(2)
到
ZL-522-01-1
ZL-531-01-1
ZL-531-01-1
ZL-531-01-1
ZL-531-01-1
我可以使用RegEx使用LINQ吗?
public class MatchCTallyToCross
{
public List<string> Get(string CustomerNumber)
{
IEngManager engManager = new EngManager();
EngCustomerMyCross engCustomerMyCross = new EngCustomerMyCross();
engManager.Load(engCustomerMyCross);
return engCustomerMyCross.myEngCustomerCross.
Where(c => c.ENG_CUSTOMERMYCROSS_CUSTOMER_NUMBER == CustomerNumber).
Select(c => c.ENG_CUSTOMERMYCROSS_MYTECHNIC_TASK_NO).ToList();
}
}
c => c.ENG_CUSTOMERMYCROSS_MYTECHNIC_TASK_NO result is equal to "A320-ZL-531-01-1(2)"
但我需要"ZL-531-01-1"
。
答案 0 :(得分:0)
为什么不使用linq内的extension Method来使用正则表达式重新格式化字符串。
c.ENG_CUSTOMERMYCROSS_MYTECHNIC_TASK_NO.ToNewDateFormat()//calling the extension method