![]() ![]() They won't break anything (or much) - mainly because I don't think anyone is using the String.Split method with a string longer than 1 since it doesn't work anyway.ĭim DelimiterSet() As Char = I would have though that the implementation of the String.Split method would have recognized a more up-to-date set of requirements. I think this is a shame because the days of delimiting text with a single character is a 1980s approach. I also think they screwed up in the internal conversion to a char array and only took the first character in the string. ![]() I think the person implementing the method saw this to mean that they should treat it the same as an array of chars and use individual characters from the string as separate delimiters. I bolded that because that is what it says in the MSDN Documentation for the String Class Split method. The requirement was also to allow passing in a string of one or more characters. Inside the method the string being parsed is likely being handled like an array of chars for speed and a simple comparison is being done. The VB.NET product manager wisely wanted to allow users to specify multiple delimiters, so s/he asked for an overloaded method that allows the user to pass an array of chars. You can, however, revert to the Classic VB Compatibility Split function - but some of us like to avoid that as we expand our knowledge base of canonical. Unfortunately you cannot use the String Class Split Method in VB.NET to do anything like the Split function in VB6. That's handy if you need to split a sting that uses multiple delimiters. You can pass in an array of chars(), and it will use each of them as separate delimiters. In VB.NET you can pass the split method a string, but it ignores all but the first character. the split method ignores all but the first character - which it uses as the sole delimiter. Dim MySplittableString as String = "onetwothreefourfive"ĭim MyArray() as String = MySplittableString.Split"") ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |