简体   繁体   English

如何使用分隔符在 vb.net 中拆分字符串数组中的多行字符串?

[英]How to split a multi-line string in string array in vb.net using Delimeter?

I have utility in VB language.我有 VB 语言的实用程序。 That splits the string.这拆分了字符串。 User provide string(may be multiline string) and delimiter.用户提供字符串(可能是多行字符串)和分隔符。 And output will be string array. output 将是字符串数组。 What will be the input delimiter to split string from new Line?.从新行拆分字符串的输入分隔符是什么?

Currently I am using Dim output = Split(InputString, delimiter) to split string.目前我正在使用Dim output = Split(InputString, delimiter)来拆分字符串。

In VB code there is option Environment.NewLine .在 VB 代码中有选项Environment.NewLine

But end user know only "\n" for new line.但最终用户只知道换行的“\n”。

So my question is What will be the input delimiter to split string from new Line?所以我的问题是从新行拆分字符串的输入分隔符是什么?

Probably vbCrLf , vbLf or vbCr , depending on what is in your string.可能是vbCrLfvbLfvbCr ,具体取决于字符串中的内容。

If they are typing the text in a TextBox or saving it in a file, vbCrLf should split your string into individual lines.如果他们在 TextBox 中键入文本或将其保存在文件中, vbCrLf应该将您的字符串拆分为单独的行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM