字符串截取

2024/4/16 7:57:07

JS 截取字符串

1.截取字符串后面1位 var x 123qwe; x.slice(-1)2.

shell脚本常用处理

1.日期参数转自定义格式(注意执行命令的符号 和 ‘ 的区别) yes$1 echo $yes milsdate -d "$yes -1 day" %s #参数日期减一天转毫秒 echo $mils yesterdaydate -d $mils %Y/%m/%d #格式化yyyy/mm/dd形式 echo $yesterdaymilsdate -d "$yes -3 hours -1…

java 路径截取--截取倒数第二个指定字符之前/后的字符串

java 路径截取–截取倒数第二个指定字符之前/后的字符串 截取倒数第二个"/"之前的字符串 String path"/home/henry/Desktop/1.txt";//获得""/home/henry",并且不需要前面的"/" String oopath.substring(0,path.lastIndexOf("…

03-截取字符串(字符串处理)

StringUtil.java package com.lh.bean; public class StringUtil {// 需要截取的字符串private String str;public String getStr() {// 如果字符串的长度大于50,则从0开始截取到50,之后的亿省略号来代替if (str.length() > 50) {return str.substri…

python split()截取一部分的字符串

代码如下: str https://www.baidu.com/pdf/abcdefg.pdf# 输出字符串,>>>https://www.baidu.com/pdf/abcdefg.pdf print(str)# 做为一个整体截取,>>>[https://www.baidu.com/pdf/abcdefg.pdf] print(str.split())# 把字符…