• Oracle/PLSQL: LTRIM Function-from cyber


    Oracle/PLSQL: LTRIM Function

    This Oracle tutorial explains how to use the Oracle/PLSQL LTRIM function with syntax and examples.

    Description

    The Oracle/PLSQL LTRIM function removes all specified characters from the left-hand side of a string.

    Syntax

    The syntax for the LTRIM function in Oracle/PLSQL is:

    LTRIM( string1 [, trim_string] )

    Parameters or Arguments

    string1
    The string to trim the characters from the left-hand side.
    trim_string
    Optional. The string that will be removed from the left-hand side of string1. If this parameter is omitted, the LTRIM function will remove all leading spaces from string1.

    Note: See also the RTRIM and TRIM functions.

    Applies To

    The LTRIM function can be used in the following versions of Oracle/PLSQL:

    • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

    Example

    Let's look at some Oracle LTRIM function examples and explore how to use the LTRIM function in Oracle/PLSQL.

    For example:

    LTRIM('   tech')
    Result: 'tech'
    
    LTRIM('   tech', ' ')
    Result: 'tech'
    
    LTRIM('000123', '0')
    Result: '123'
    
    LTRIM('123123Tech', '123')
    Result: 'Tech'
    
    LTRIM('123123Tech123', '123')
    Result: 'Tech123'
    
    LTRIM('xyxzyyyTech', 'xyz')
    Result: 'Tech'
    
    LTRIM('6372Tech', '0123456789')
    Result: 'Tech'

    The LTRIM function may appear to remove patterns, but this is not the case as demonstrated in the following example.

    LTRIM('xxyyxzyxyyxTech', 'xyz')
    Result: 'Tech'

    It actually removes the individual occurrences of 'x', 'y', and 'z', as opposed to the pattern of 'xyz'.

    The LTRIM function can also be used to remove all leading numbers as demonstrated in the next example.

    LTRIM( '637Tech', '0123456789')
    Result: 'Tech'

    In this example, every number combination from 0 to 9 has been listed in the trim_string parameter. By doing this, it does not matter the order that the numbers appear in string1, all leading numbers will be removed by the LTRIM function.

  • 相关阅读:
    java fork/join简单实践
    java 中的字符串处理--正则表达式
    那些年,我们追过的java8
    openssl与java(读取加密码的密钥)
    SpringMVC 常用注解的使用和解释
    Spring 常用注解的使用
    java web 一次请求编码设置的过程
    Spring让程序生成程序
    设置session超时的三种方式
    为什么 cookie.getMaxAge() 总是得到 -1 ?
  • 原文地址:https://www.cnblogs.com/Jeffrey-xu/p/4819556.html
Copyright © 2020-2023  润新知