[ASK]-关于.NET中的内置功能 [英] [ASK] - About built-in function in .NET

查看:78
本文介绍了[ASK]-关于.NET中的内置功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我想问一下有关内置.net的功能.
例如,如果我们要制作这样的批号:"0001",则可以在我们的代码中这样写:

Hi all, i wanna ask you about function that is built-in .net.
For example, if we want to make batch number like this : "0001", we can make in our code like this :

batch.PadLeft(4, "0");



但是,如果我有一个字符串,其格式如下:



But, if i have a string which have a format like this :

BankID|ExtRef|SeqNum|AC|CurCod|ValDate|OpenBal|ValDate|TrxtRef|TrxType|DC|CashVa
l|Description|CloseBal|Note



主要问题是如何获取BankID,ExtRef,SeqNum等.
.NET中是否内置任何功能,例如"PadLeft"?或者我必须开始使用StreamReader读取此格式,然后开始一一拆分,这样我才能获得BankID,ExtRef等.
您能给我关于这种格式的任何建议吗? :〜



The main question is how to get BankID, ExtRef, SeqNum, etc..??

Is there any function that is built in .NET like "PadLeft"?? Or i must start reading this format by using StreamReader and then start split one by one, so i can get BankID, ExtRef, etc..???

May you give me any suggestion for this format..?? :~

推荐答案

要拆分字符串,请执行以下操作:

To split a string, do something like this:

string myString = "BankID|ExtRef|SeqNum|AC|CurCod|ValDate|OpenBal|ValDate|TrxtRef|TrxType|DC|CashVal|Description|CloseBal|Note"

string[] parts = myString.Split(''|'');



在这一点上,您的字符串被拆分为由"|"字符分隔的各个部分. PadLeft与您显然想做什么有什么关系?



At this point, your string is split into the various parts that are separated by the ''|'' character. What does PadLeft have to do with what you apparently want to do?


这篇关于[ASK]-关于.NET中的内置功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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