Reputation: 1508
How can I split a string with a string?
string PostBuffer = "This Is First----WebKitFormBoundaryBBZbLlWzO0CIcUa6This Is Last"
string[] bufferarray = PostBuffer.Split("----WebKitFormBoundaryBBZbLlWzO0CIcUa6", StringSplitOptions.None);
I get and error cannot convert Argument '1' from string to char and I get Argument '2' cannot convert from system.stringsplitoptions to char.
What am I doing wrong?
Upvotes: 1
Views: 1992
Reputation: 30872
This is because the first argument is:
Type: System.String() An array of strings that delimit the substrings in this string, an empty array that contains no delimiters, or Nothing.
So you need to do:
string[] bufferarray =
PostBuffer.Split(new string[] { "----WebKitFormBoundaryBBZbLlWzO0CIcUa6" }, StringSplitOptions.None);
You can read more from the docs.
Upvotes: 2
Reputation: 23132
There is no overload for string.Split
which takes a string and StringSplitOptions
as arguments. Do this instead:
string[] bufferarray =
PostBuffer.Split(new string[] { "----WebKitFormBoundaryBBZbLlWzO0CIcUa6" }, StringSplitOptions.None);
Upvotes: 1
Reputation: 16162
PostBuffer.Split(new string[] { "----WebKitFormBoundaryBBZbLlWzO0CIcUa6"}, StringSplitOptions.None);
Upvotes: 4