加入了智能分离器 [英] Join with intelligent separators
本文介绍了加入了智能分离器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是很容易,当然写的,但在C#2010,有一个内置的加入(或类似)方法,只会增加一个分隔符,如果previous和下一个元素都是非空和非空?
It's easy enough to write, of course, but in C# 2010, is there a built-in Join (or similar) method that will only add a separator if both the previous and next elements are non-null and non-empty?
在换句话说 SmartJoin(,,胡德号,罗宾)
将产生胡德,罗宾,但 SmartJoin( ,罗宾汉,的String.Empty)
会产生简单的劫富济贫。
In other words SmartJoin(", ","Hood","Robin")
would produce "Hood, Robin" but SmartJoin(", ", "Robin Hood", string.Empty)
would produce simply "Robin Hood".
推荐答案
有没有内置的加入,你所需要的。
There is no built-in join which you need.
这篇关于加入了智能分离器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文