zoukankan      html  css  js  c++  java
  • oracle 内置函数(二)字符函数

    主要函数:

    • 大小写转换函数
    • 获取子字符串函数(字符串截取)
    • 获取字符串长度函数
    • 字符串连接函数
    • 去除子字符串函数
    • 字符替换函数
    • 字符串出现次数
    • 字符串按照特定符号拆分多行

    一、大小写转换

    1、upper:转大写

    2、lower:转小写 

    3、initcap:首字母大写

    二、获取子字符串函数(字符串截取)

    substr(str,beginIndex,endIndex)

    str:需要处理的字符串

    beginIndex:开始截取下标位置,>0时从头部开始数下标,<0时从尾部数下标。

    endIndex:结束下标。

    三、获取字符串的长度

    length(str)

    获取字符串占字节数:

    lengthb('中')

    四、字符串拼接

    concat(str1,str2):我觉得没有'||'用的方便:

    五、去除子字符

    trim(car from str):从str去掉所有car。觉得鸡肋

    ltrim(car,str):从left左开始去掉第一个

    rtrim(car,str):从right右开始去掉第一个

    trim(str):去掉首位空格

    六、替换

    replace(str1,str2,str3):

    str1:需要处理的字符串

    str2:需要替换掉的字符串

    str3:替换上去的字符串,该参数可以不写和trim效果一样

     七、字符串出现次数

    select regexp_count('上海自来水来自海上', '')  from dual;

     八、字符串按照特定符号拆分多行

    select regexp_substr('444.555.666', '[^.]+', 1, level) col
      from dual
    connect by level <= regexp_count('444.555.666', '.') + 1;
    

      

  • 相关阅读:
    Vue条件判断
    揭秘webpack plugin
    vue实现网络图片瀑布流 + 下拉刷新 + 上拉加载更多
    npx 是什么?
    PAT 1100 Mars Numbers[难]
    PAT 1075 PAT Judge[比较]
    PAT 1083 List Grades[简单]
    PAT 1082 Read Number in Chinese[难]
    PAT 1135 Is It A Red-Black Tree[难]
    PAT 1127 ZigZagging on a Tree[难]
  • 原文地址:https://www.cnblogs.com/ckxlovejava/p/7129177.html
Copyright © 2011-2022 走看看