方法: function insertHtmlAtCaret(html) { var sel, range; if (window.getSelection) { // IE9 and non-IE sel = window.getSelection(); if (sel.getRangeAt && sel.rangeCount) { range = sel.getRangeAt(0); range.deleteContents(); // Range.createContextualFr…
正确截取List指定位置的内容 import java.util.ArrayList; import java.util.List; public class ListUtils { public static <T> List<T> getSubList(List<T> list, int fromIndex, int toIndex) { //list.stream().limit(toIndex); if (toIndex > list.size()) {…
下面的例子是在文件的指定位置增加指定字符串的例子 修改配置文件: def add_str(pre_str): lines = [] flag = True f = open("z.txt") for line in f: lines.append(line) if line.strip("\n ") == "</se.diabol.jenkins.pipeline.DeliveryPipelineView>" and flag: li…