[1编写函数]CREATE FUNCTION IndexOf(@str VARCHAR(500),@value VARCHAR(50),@posIndex INT)RETURNS int AS BEGIN DECLARE @pos int=0 --记录位置 DECLARE @i INT =0 --记录查找的次数 WHILE(@i<@posindex) BEGIN SET @i=@i+1 set @pos=CHARINDEX(@value,@str,@pos+1) IF(@pos=0) RETUR…
var box = "this is javascript"; for (var i = -1, arr = []; (i = box.indexOf("s", i + 1)) > -1; arr.push(i)); alert(arr); 其原理还可以这样理解: var str ="this is javascript" var resault ={index:"",count:0}; while ( true ){…
// 给定一个set字符和一个正数k,找出所有该做set它可以由长度构成k该字符串集合 /* Input: set[] = {'a', 'b'}, k = 3 Output: aaa aab aba abb baa bab bba bbb Input: set[] = {'a', 'b', 'c', 'd'}, k = 1 Output: a b c d package recursion; import java.util.ArrayList; public class N_sets_form…