substr

presto unixtimestamp转标准日期

匿名 (未验证) 提交于 2019-12-02 23:55:01
用到presto两个函数 1. from_unixtime 2.format_datetime select '1566748800000' , substr ( '1566748800000' , 1 , 10 ) as a , from_unixtime ( cast ( substr ( '1566748800000' , 1 , 10 ) as int )) as b , -- 将 13 位毫秒级的 unix timestamp 截取到秒级别 format_datetime ( from_unixtime ( cast ( substr ( '1566748800000' , 1 , 10 ) as int )), 'yyyy-MM-dd' ) 转换结果 参考资料 https://prestodb.github.io/docs/current/functions/datetime.html 来源:博客园 作者: MrZhang_ 链接:https://www.cnblogs.com/MrZhangL/p/11417960.html

[Leetcode] Palindrome Partitioning

匿名 (未验证) 提交于 2019-12-02 23:49:02
原文链接: http://www.cnblogs.com/easonliu/p/3657733.html s s s . s "aab" , Return [ ["aa","b"], ["a","a","b"] ] 像这样列举所有结果的只能DFS了。不过为什么我老是忘记写++low跟--high呢,都死循环了自己还不知道! 1 class Solution { 2 public : 3 bool isPail( string & s) { 4 int low = 0 , high = s.length() - 1 ; 5 while (low < high) { 6 if (s[low] != s[high]) { 7 return false ; 8 } 9 ++ low; 10 -- high; 11 } 12 return true ; 13 } 14 15 void findNext(vector<vector< string > > &res, string &s, vector< string > part, int idx) { 16 if (idx == s.length()) { 17 res.push_back(part); 18 return ; 19 } 20 string substr; 21 for ( int len = s.length() -

yymmdd转换为yy-mm-dd

喜夏-厌秋 提交于 2019-12-02 23:47:42
场景:mysql表table存的日期列为dt,数据格式为yymmdd,例如:20191030 select concat(substr(dt,1,4),'-',substr(dt,5,2),'-',substr(dt,7,2)) from table where dt = '20191030' 结果是:2019-10-30 来源: https://www.cnblogs.com/xuebf/p/11767944.html

《收获,不止SQL优化》读书笔记

匿名 (未验证) 提交于 2019-12-02 23:47:01
原文链接:https://smilenicky.blog.csdn.net/article/details/94862797, 我的sql调优专栏:https://smilenicky.blog.csdn.net/article/category/8679315 AWR、ASH、ADDM、AWRDD 整体分析调优工具 AWR:关注数据库的整体性能的报告; ASH:数据库中的等待事件与哪些SQL具体对应的报告; ADDM:oracle给出的一些建议 AWRDD:Oracle针对不同时段的性能对比报告 AWRSQRPT:oracle获取统计信息与执行计划 不同场景对应工具 局部分析调优工具: explain plan for set autotrace on statistics_level=all 直接通过sql_id获取 10046 trace awrrpt.sql 整体性能工具要点 AWR关注点:load profile、efficiency percentages、top 5 time events、SQL Statistics、segment_statistics ASH关注点:等待事件与sql完美结合 ADDM:各种建议与对应SQL AWRDD:不同时期 load profile的比较、不同时期等待事件的比较、不同时期TOP SQL的比较 AWRSQRPT:获取与关注点

对数字加千分号实现

匿名 (未验证) 提交于 2019-12-02 23:41:02
千分号能够快速的读出数值,所以在财务等数据统计中很常用 具体代码: function num_format($num) { if (!is_numeric($num)) { return false; } $num = explode('.', $num);//把整数和小数分开 $j = strlen($num[0]) % 3;//整数有多少位 $sl = substr($num[0], 0, $j);//前面不满三位的数取出来 $sr = substr($num[0], $j);//后面的满三位的数取出来 $rvalue = ''; $i = 0; while ($i <= strlen($sr)) { $rvalue = $rvalue . ',' . substr($sr, $i, 3);//三位三位取出再合并,按逗号隔开 $i = $i + 3; } $rvalue = $sl . $rvalue; $rvalue = substr($rvalue, 0, strlen($rvalue) - 1);//去掉最后一个逗号 $rvalue = explode(',', $rvalue);//分解成数组 if ($rvalue[0] == 0) { array_shift($rvalue);//如果第一个元素为0,删除第一个元素 } $rv = $rvalue[0];/

js String对象中常用方法小结

匿名 (未验证) 提交于 2019-12-02 23:41:02
1、charCodeAt方法返回一个整数,代表指定位置字符的Unicode编码。 strObj.charCodeAt(index) 说明: index将被处理字符的从零开始计数的编号。有效值为0到字符串长度减1的数字。 如果指定位置没有字符,将返回NaN。 例如: var str = "ABC"; str.charCodeAt(0); 结果:65 2、fromCharCode方法从一些Unicode字符串中返回一个字符串。 String.fromCharCode([code1[,code2...]]) 说明: code1,code2...是要转换为字符串的Unicode字符串序列。如果没有参数,结果为空字符串。 例如: String.fromCharCode(65,66,112); 结果:ABp 3、charAt方法返回指定索引位置处的字符。如果超出有效范围的索引值返回空字符串。 strObj.charAt(index) 说明: index想得到的字符的基于零的索引。有效值是0与字符串长度减一之间的值。 例如: var str = "ABC"; str.charAt(1); 结果:B 4、slice方法返回字符串的片段。 strObj.slice(start[,end]) 说明: start下标从0开始的strObj指定部分其实索引。如果start为负,将它作为length

substr() method in C++

我们两清 提交于 2019-12-02 23:39:27
问题 I am trying to substring some expressions into individual tokens such as !, &, | (), etc. What I am having trouble with is the fact that when I try to make a sub-string of "!(S&B|H)&!(S&J|R)&!(P)" with the cout line below, I get: "(S&J|R)&!(P)", when I thought it should be: "(S&J|R)". It either is beyond what I have seen or just so simple that I just am not getting it. Any help would help a lot. Thanks. #include <iostream> #include <string> using namespace std; int main(int argc, const char *

sql字符串截取

匿名 (未验证) 提交于 2019-12-02 23:38:02
版权声明:转载前请注明出处,谢谢 https://blog.csdn.net/weixin_41770169/article/details/90773166 使用SUBSTR实现字符串截取: SUBSTR(string, Nstart, Nend) AS stringnew 比如: (1)截取字符串前10位 string = '20190604080910' Nbegin = 1 Nend = 10 SUBSTR(string, Nbegin, Nend) AS stringnew 则: stringnew = '2019060408' (2)截取字符串后6位 string = '20190604080910' Nbegin = 9 Nend = 14 SUBSTR(string, Nbegin, Nend) AS stringnew 则: stringnew = '080910' 文章来源: https://blog.csdn.net/weixin_41770169/article/details/90773166

oracle截取字段中的部分字符串:日期格式转换

匿名 (未验证) 提交于 2019-12-02 23:36:01
##从数据库中导出excel数据后,造数据,然后重新导入oracel数据库中,查询后显示导入成功 但是页面还是显示是老的数据,后来发现日期自动变化了2016-05-06变化为2016/05/06 导致无法显示 导入后错误的数据 ##更改日期格式语句:update T_JN_JSC_COMPLETOIN set plan_date =substr(plan_date, 7, 11) ||’-’|| substr(plan_date, 0, 2) || ‘-’ || substr(plan_date, 4, 2) where plan_date like ‘%/%’; commit; ##这条语句可以吧日期替换为2016-05-06格式 在Oracle中可以使用instr函数对某个字符串进行判断,判断其是否含有指定的字符。 其语法为: instr(sourceString,destString,start,appearPosition). instr(‘源字符串’ , ‘目标字符串’ ,‘开始位置’,‘第几次出现’) 其中sourceString代表源字符串; destString代表想聪源字符串中查找的子串; start代表查找的开始位置,该参数可选的,默认为1; appearPosition代表想从源字符中查找出第几次出现的destString,该参数也是可选的,默认为1;

go中strings包的完整使用教程

匿名 (未验证) 提交于 2019-12-02 23:32:01
关于go语言中strings包的完全使用教程 1. func Compare(a, b string) int {} 比较返回一个按字典顺序比较两个字符串的整数。如果a == b则结果为0,如果a <b则结果为-1,如果a> b则结果为+1。 此外:仅包含与包字节对称的比较。使用内置字符串比较运算符==,<,>等通常更清晰,速度更快。 fmt.Println(strings.Compare(“a”,“b”)) fmt.Println(strings.Compare(“a”,“a”)) fmt.Println(strings.Compare(“b”,“a”) ) 输出: -1 0 1 注意:使用大于等于小于同样可以得到同样的答案。 2. func Contains(s, substr string) bool {} 判断字符串substr是否在字符串s中,返回类型为布尔值。 fmt.Println(strings.ContainsAny(“team”,“i”)) fmt.Println(strings.ContainsAny(“failure”,“u&i”)) fmt.Println(strings.ContainsAny(“foo”,“” )) fmt.Println(strings.ContainsAny(“”,“”)) 输出: false true false false 3.