Perform Trim() while using Split()

后端 未结 7 1212
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 15:53

today I was wondering if there is a better solution perform the following code sample.

string keyword = \" abc, foo  ,     bar\";
string match = \"foo\";
str         


        
7条回答
  •  爱一瞬间的悲伤
    2020-12-23 16:41

    I would suggest using regular expressions on the original string, looking for the pattern "any number of spaces followed by one of your delimiters followed by one or more spaces" and remove those spaces. Then split.

提交回复
热议问题