日期:2014-05-18 浏览次数:21111 次
object[] oSendArray = null
------解决方案--------------------
产生了数组 付给了 object[] o = new object[19]; o[1]=oSendArray; 传出去了
o是不是做为一个函数的返回值了?如果是,接收返回值的地方可以这样处理:
object[] acceptO=...O;
object[] thisO;
thisO=acceptO[1] as object[];
if (thisO != null)
{
...
}
------解决方案--------------------
        /// <summary>
       /// 提取分割没有分割符的string (须添加 using System.Text.RegularExpressions;)  
       /// </summary>
       /// <param name="sendString"> 需要分割的字符串</param>
       /// <param name="pattern">分割需要匹配的正则表达式字符</param>
       /// <returns> 分割后得到的数组(当然此处也可以返回其他格式的东西)</returns>
       public static string[] SplitStringWithoutSplitChar(string sendString, string pattern)
       {
           Regex regex = new Regex(pattern);
           MatchCollection mc = regex.Matches(sendString);
           string[] OPstring = new string[mc.Count];
           for (int i = 0; i < mc.Count; i++)
           {
               OPstring[i] = mc[i].Value;
           }
           return OPstring;
       }
       此处.
       string sendcode = "A22B301K2T6";
       string pattern = "[A-Z][0-9]*";
       string[] splitString  ;
       splitString = SplitStringWithoutSplitChar(sendcode,  pattern) ;
       //
------解决方案--------------------
确实,从楼主的代码中没法看明白前面描述的处理逻辑
纯粹从所描述的数据处理要求来看,用正则表达式比较方便,楼上的算法正确