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
Post a Comment