string[]
如果数组元素不是从数组开始,我们可以从数组中删除数组元素吗'%'
string[] saBytesReceived = null;
bDataReceived = new byte[bBytesToRead]; //byte[] array
networkStream.Read(bDataReceived, 0, bBytesToRead);
try
{
if (ASCIIEncoding.ASCII.GetString(bDataReceived).Trim() != "")
{
saBytesReceived = ASCIIEncoding.ASCII.GetString(bDataReceived)
.Split(new string[] { "\0" }, StringSplitOptions.None);
saBytesReceived = saBytesReceived.Select(s => s.Replace("?", "")).ToArray();
saBytesReceived = //Remove array elements in One single Line
}
}
我不想使用任何循环..仅通过使用LINQ我们可以在单行中完成吗?
我的样本数组
65928346897326
34623462346346
%346346
%436534
32632463667364
结果数组应该是
%346346
%436534