我有一个包含字符串值的列表。我需要修剪前导值和结束值。这是代码:
using EnterpriseDT.Net.Ftp;
public List<FTPFile> FileList = new List<FTPFile>();
FTP = new FTPConnection() { ServerAddress = _host, UserName = _user, Password = _password };
FTP.Connect();
FTP.TransferType = FTPTransferType.BINARY;
FTP.ChangeWorkingDirectory(_as400_directory);
FTP.LocalDirectory = _local_directory;
FileList.AddRange(FTP.GetFileInfos());
FTP.Close();
FileList 列表包含以下示例值:
test 123 11/01/12 *STMF File1.csv somegarbagevalues
test 123 11/01/12 *STMF File2.csv somegarbagevalues
test 123 11/01/12 *STMF File3.csv somegarbagevalues
我需要做的是在线捕获文件名(例如 File1.csv、File2.csv ...)有没有办法在我执行 FileList.AddRange 语句时修剪不需要的值而无需遍历列表或修剪?