如何转化为电子资金转账.txt文件中的数据 [英] How to Transform the data in a .txt file for Electronic Fund Transfers

查看:133
本文介绍了如何转化为电子资金转账.txt文件中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此​​,在我们的ERP / PSA软件产生EFT其中包含银行和员工的银行信息,然后发送给银行的那一刻(电子转账).txt文件。

问题是如下到当前正在生产的电子转帐文件是美国标准,不适合于加拿大的银行标准的格式。但我所需要的加拿大银行的标准格式。

文件的格式是所有关于在一个文件中的列的数目和它们包含(如果该列的数据犯规达到字符它填充位的数目)的字符数。

所以即

  1011234567Joe,布洛斯1234567

和例如可以说我试着变换加拿大标准

  A101Joe,布洛斯1234567 1234567

其中例如A的需要添加到第一行中的记录

我只是想知道如何去用C#

这样的任务

阅读文本文件中。
逐行分析在启动方面的数据和字符结束
给变量赋值
重建新的文件,这些变量与不同的排序和附加数据


解决方案

  VAR线= File.ReadAllLines(inputPath);
VAR的结果=新的List<串GT;();
的foreach(在VAR行线)
{
    results.Add(的String.Format(A {0},行));
}
File.WriteAllLines(outputPath,results.ToArray());

So at the moment our ERP/PSA software produces an EFT (Electronic Fund Transfer) .txt file which contains Bank and employee bank information which is then sent to the bank.

Problem is as follows the format to which the EFT File is currently being produced is US standard and not suitable to Canadian bank standards. But I have the required canadian bank standard format.

The format of the file is all about number of columns in a file and the number of characters they contain (if the data for the column doesnt reach the number of characters it is filled with spaces).

So I.e.

1011234567Joe,Bloggs      1234567

And for example lets say I try transform to Canadian Standard

A101Joe,Bloggs    1234567   1234567

Where for example "A" needs to be added to first line in the record.

I'm just wondering how to go about a task like this in C#

I.e.

Read in text file. Line by Line parse data in terms of start and end of characters Assign values to variables Rebuild new file with these variables with different ordering and additional data

解决方案

var lines = File.ReadAllLines(inputPath);
var results = new List<string>();
foreach (var line in lines)
{
    results.Add(string.Format("A{0}", line));
}
File.WriteAllLines(outputPath, results.ToArray()); 

这篇关于如何转化为电子资金转账.txt文件中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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