.net 所有字符两两组合
String[] arr = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
已知一个数组
期望得到
aa,ab,ac,ad...... 这个方法如何写了? .net
[解决办法]
循环套个循环呗,虽然有点笨。
[解决办法]
如果用sql语句很简单,但用数组就不太清楚了?
[解决办法]
参考:
create table #tb (a1 varchar (2))
insert into #tb values('a')
insert into #tb values('b')
insert into #tb values('c')
insert into #tb values('d')
insert into #tb values('e')
insert into #tb values('f')
insert into #tb values('g')
insert into #tb values('h')
insert into #tb values('i')
insert into #tb values('j')
insert into #tb values('k')
insert into #tb values('l')
insert into #tb values('m')
insert into #tb values('n')
insert into #tb values('o')
insert into #tb values('p')
insert into #tb values('q')
insert into #tb values('r')
insert into #tb values('s')
insert into #tb values('t')
insert into #tb values('u')
insert into #tb values('v')
insert into #tb values('w')
insert into #tb values('x')
insert into #tb values('y')
insert into #tb values('z')
insert into #tb values(0)
insert into #tb values(1)
insert into #tb values(2)
insert into #tb values(3)
insert into #tb values(4)
insert into #tb values(5)
insert into #tb values(6)
insert into #tb values(7)
insert into #tb values(8)
insert into #tb values(9)
select *
from (
select a.a1+b.a1 as bb
from #tb a ,#tb b
)t
order by bb
drop table #tb
/*
(1296 row(s) affected)
*/
[解决办法]
结果1296行,只帖出一部分:
/*
00
01
02
03
04
05
06
07
08
09
0a
0b
0c
0d
0e
0f
0g
0h
0i
0j
0k
0l
0m
0n
0o
0p
0q
0r
0s
0t
0u
0v
0w
0x
0y
0z
10
11
12
13
*/
[解决办法]
http://blog.csdn.net/qq873113580/article/details/10521915
这里
[解决办法]
这个不就可以得到你要的答案了吗?