Can anyone explain the components of this in bold? I don’t know .NET but I do understand splitting a string using a CRLF as a delimiter. I’ve done simple operations with substring, successfully experimenting but not with the .ToCharArray method. Also the general structure of the statement with the “0” index I do not understand.
Splitting string with new line , take first element of output and then take string after TaxID
VendorInformation.Split(Environment.NewLine. ToCharArray )( 0 ).Substring("TaxID: ".Length)ets take
VendorInformation.Split(Environment.NewLine. ToCharArray ) this expression will return array of strings as following
(0) means take first element of array ie TaxID: 1234
Subtring this 1st element after TaxID
So output will be 1234.
Ps-you need to trim the result as it contains some extra space
Thanks. I see that this is just a continuing hierarchy. I have done a split but it seems that the “.ToCharArray” is NOT necessary. So why is it there?
My brain would have created two lines to accomplish this but I see each “.” creates a successive result to build upon
Test1 = Test.Split(Environment.NewLine)
Although less readable IMHO but it accomplishes it in one line (no ToChar):
Why would they put that? Is it necessary or a best practice although a default behavior?