zoukankan      html  css  js  c++  java
  • sql

    1.截取字符串

    mysql

    SUBSTRING_INDEX(SUBSTRING_INDEX(b.`ELEMENT_ALLPARENT_ID`,',',3),',',-1) AS deno

    oracle

    '402881e96274cd86016274cd86630000,8aaa87176415997a016421903b720034,402881e96275cee9016275d4fbdd000a'   截取,号后的32位

    select substr('402881e96274cd86016274cd86630000,8aaa87176415997a016421903b720034,402881e96275cee9016275d4fbdd000a',
    instr('402881e96274cd86016274cd86630000,8aaa87176415997a016421903b720034,402881e96275cee9016275d4fbdd000a',',',-1,1)+1,32
    )from dual

    instr(sourceString,destString,start,appearPosition).   instr('源字符串' , '目标字符串' ,'开始位置','第几次出现'
    返回目标字符串的位置   下标从1开始
    SQL> select instr('yuechaotianyuechao','ao') position from dual;
     
     POSITION
     ----------
     6
     
    从第7个字符开始搜索<br>
    SQL> select instr('yuechaotianyuechao','ao', 7) position from dual;
     
     POSITION
     ----------
     17
     
    substr( string, start_position, [ length ] )       substr('目标字符串',开始位置,长度)
          substr('This is a test', 6, 2)     would return 'is'
          substr('This is a test', 6)     would return 'is a test'
          substr('TechOnTheNet', -3, 3)     would return 'Net'
  • 相关阅读:
    多线程
    python 进程间通信
    python 生产者消费者模型
    多线程锁
    io多路复用(三)
    div 加滚动条的方法
    10矩形覆盖
    11.二进制中1的个数
    12数值的整数次方
    9 变态跳台阶
  • 原文地址:https://www.cnblogs.com/jentary/p/11579137.html
Copyright © 2011-2022 走看看