如何将逗号分隔符的字符串传递给小数点[] [英] how we can pass the string of comma seperator value to decimal[]

查看:59
本文介绍了如何将逗号分隔符的字符串传递给小数点[]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string _shipId = string.Empty;
 decimal[] _SelectShipIId;
 foreach (ShippingCarrierDTO _ship in _site.ShipVia)
 {
   if (string.IsNullOrEmpty(_shipId))
 {
  _shipId = Convert.ToString(_ship.ShipIId);
 }
 else
 {
   _shipId += "," + Convert.ToString(_ship.ShipIId);
 }
}
 
 _SelectShipIId =new decimal[_shipId.Length];
 for (int i = 0; i < _shipId.Length; i++)
 {
  _SelectShipIId[i] = _shipId[i];
 }


_shipid正在获取值为2.
但是我正在将_shipid值传递给小数点[] _SelectShipIId
在十进制[] _SelectShipIId获得另一个值为50的时候.

我需要_shipid中的值与我要获得的值相同
_SelectShipIId


在顶部,我的代码在那里尝试了..

请帮助我解决这个问题..


_shipid am getting the value is 2.
but the am passing the _shipid value to decimal[] _SelectShipIId
at the time the decimal[] _SelectShipIId is getting another value that is 50..

I need what am having the value in _shipid the same value i need to get in
_SelectShipIId


In the top my code is there that is what am tried ..

Please help me to solve this..

推荐答案

我认为您需要先调用split by,然后才能使用String [] ...格式的字符串.像这样的东西:

CDec(_shipID.ToString.Split(,")(i))
I think you need to call split by , before you could get a string on the format String[].... Something like:

CDec(_shipID.ToString.Split(",")(i))


这篇关于如何将逗号分隔符的字符串传递给小数点[]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆