string split c#
Go to solution
Solved by stefanmz,
19 minutes ago, minibois said:Can you post your code and show the output?
It should probably go like this:
string s = "text1=>text2=>text3=>"; string[] subs = s.Split('=', '>');with subs now being a string array with these 'text1', etc. strings in it.
27 minutes ago, AbydosOne said:Hacky answer: split on '=' and remove '>' from all resulting strings (or vice versa).
EDIT: potentially less hacky: Use a String ("xxx") instead of Character ('x') and see if that works.
So I tried both and it works only after adding this System.StringSplitOptions.RemoveEmptyEntries in the method for string split. I don't know what it does but it works fine so thanks
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now