开发者

C# custom string split library,

开发者 https://www.devze.com 2023-02-02 15:22 出处:网络
Are their any 开发者_StackOverflowcustom c# string split scripts, that will enable a string to be split but still retain the split characters in each of the split strings.

Are their any 开发者_StackOverflowcustom c# string split scripts, that will enable a string to be split but still retain the split characters in each of the split strings.

For example, if I split "ABCD CRLF ABC" with first string retaining the carriage return/line feed resulting in two strings:

ABCD CRLF

ABC

Bob.


I think what you're after is

string[] lines =  Regex.Split(inputString, @"(?<=\r\n)(?!$)");
0

精彩评论

暂无评论...
验证码 换一张
取 消