public void TestJoin2() { string[] instrs = { @"A", @"B", @"C", @"D", @"E", @"F" }; string sep = @","; string expstr = @"C,D,E"; string result = StrJoins.Join(sep, instrs, 2, 3); Assert.AreEqual(expstr, result); }
public void TestJoin() { string[] instrs = { @"A", @"B", @"C" }; string sep = @","; string expstr = @"A,B,C"; string result = StrJoins.Join(sep, instrs); Assert.AreEqual(expstr, result); }
// INSERT 文生成 private string createInsertQuery(IDictionary <string, object> param) { StringBuilder sql = new StringBuilder(); sql.Append(@"INSERT INTO "); sql.Append(tblName_); sql.Append(@" ("); sql.Append(StrJoins.Join(@",", param.Keys)); sql.Append(@") VALUES ("); for (int i = 0; i < param.Count; i++) { if (i > 0) { sql.Append(@","); } sql.Append(@"?"); } sql.Append(@")"); return(sql.ToString()); }