import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author lei * 2011-9-2 */ public class StringUtils { public static String replaceBlank(String str) { String dest = ""; if (str!=null) { Pattern p = Pattern.compile("\\s*|…
博客已搬家,更多内容查看https://liangyongrui.github.io/ Mysql中交换行操作 leetcode的一道题目 参考:https://leetcode.com/problems/swap-salary/description/ 给你一个表 id name sex salary 1 A m 2500 2 B f 1500 3 C m 5500 4 D f 500 把sex的m和f交换,只能用一次update UPDATE salary SET sex = CHAR(AS…
去除字符串中的html标记及标记中的内容 --1.创建函数 create function [dbo].[clearhtml] (@maco varchar(8000)) returns varchar(8000) as begin declare @i int while 1 = 1 begin set @i=len(@maco) set @maco=replace(@maco, substring(@maco,charindex('<',@maco), charindex('>',@mac…
def stripFile(oldFile, newFile): '''remove the space or Tab or enter in a file, and output a new file in the same folder''' f = open(oldFile, 'r+', encoding='utf8') newf = open(newFile, 'w',encoding='utf8') for eachline in f.readlines(): newStr = eac…