c# - Select a part of string when find a character -


i need select part of string ,suppose have string :hello::hi,

i use characters :: separator, need separate hello , hi.i using c# application form .

i googled ,i found substring didn't me.

best regards

string.split right method, syntax little tricky when splitting based on string versus character.

the overload split on string takes input array of strings can distinquished overload takes array of characters (since string can cast array of characters), , adds parameter stringsplitentries, can set none use default option (include "empty" entries):

string source = "hello::hi"; string[] splits = source.split(new string[] {"::"}, stringsplitoptions.none); 

Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -