在代码中有如下的需求:需要在数据库中使用 in 关键字做删除的时候,又需要使用到参数化,参数又是字符串,所以使用的时候就按照如下方式 StringBuilder sql = new StringBuilder("exec('delete from Base_SysMenu where Menu_Id in('+ @ids+')') "); SqlParam[] sp ={ new SqlParam("@ids",ids) }; 数据库中的执行方式如下: exec s
1. 简单粗鲁的字符串拼接 1 name = "abc" 2 age = 25 3 info = "the name is "+name +"\nthe age is " + str(age) 4 print(info) 运行结果: 2.% name = "abc" age = 25 info = "the name is %s \nthe age is %s"%(name ,age) print(info
移除字符串左边的字符: CREATE FUNCTION [dbo].[RemoveLeftChar] ( @Expression varchar(max), @char varchar(4))RETURNS varchar(max)ASBEGIN WHILE LEN(@Expression)>0 AND CHARINDEX(@char,@Expression)=1 BEGIN SET @Expression=SUBSTRING(@Expression,LEN(@char)+1,LEN(@Expr
function getCaption(obj, text){ let index = obj.lastIndexOf(text) + text.length-1; obj = obj.substring(index+1,obj.length); return obj; } let str=" 执法办案流程-立案审批"; getCaption(str,'-');