在字符串中查找通配符的所有可能位置

时间:2016-03-24 10:17:58

标签: combinations wildcard permutation string-function

假设我有字符串“hello”,现在我想找到所有可能的组合,用通配符替换字符串中的每个字符。其中字符串长度为-1的通配符是可能的(例如4)。

e.g

_ello
h_llo
he_lo
hel_o
hell_
__llo
_e_lo

等。 (在这种情况下应该是30个)

这有什么简单的算法吗?

0 个答案:

没有答案