Class StringFunctions


  • @Experimental
    @Public
    public class StringFunctions
    extends Object
    DSL for N1QL functions in the Strings category. String functions perform operations on a string input value and returns a string or other value.
    Since:
    2.2
    Author:
    Simon Baslé
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Expression contains​(Expression expression, String substring)
      Returned expression results in True if the string expression contains the substring.
      static Expression contains​(String expression, String substring)
      Returned expression results in True if the string expression contains the substring.
      static Expression initCap​(Expression expression)
      Returned expression results in the conversion of the string so that the first letter of each word is uppercase and every other letter is lowercase.
      static Expression initCap​(String expression)
      Returned expression results in the conversion of the string so that the first letter of each word is uppercase and every other letter is lowercase.
      static Expression length​(Expression expression)
      Returned expression results in the length of the string expression.
      static Expression length​(String expression)
      Returned expression results in the length of the string expression.
      static Expression lower​(Expression expression)
      Returned expression results in the given string expression in lowercase
      static Expression lower​(String identifier)
      Returned expression results in the string value for the given identifier, in lowercase
      static Expression ltrim​(Expression expression)
      Returned expression results in the string with all leading white spaces removed.
      static Expression ltrim​(Expression expression, String characters)
      Returned expression results in the string with all leading chars removed (any char in the characters string).
      static Expression ltrim​(String expression)
      Returned expression results in the string with all leading white spaces removed.
      static Expression ltrim​(String expression, String characters)
      Returned expression results in the string with all leading chars removed (any char in the characters string).
      static Expression position​(Expression expression, String substring)
      Returned expression results in the first position of the substring within the string, or -1.
      static Expression position​(String expression, String substring)
      Returned expression results in the first position of the substring within the string, or -1.
      static Expression repeat​(Expression expression, int n)
      Returned expression results in the string formed by repeating expression n times.
      static Expression repeat​(String expression, int n)
      Returned expression results in the string formed by repeating expression n times.
      static Expression replace​(Expression expression, String substring, String repl)
      Returned expression results in a string with all occurrences of substr replaced with repl.
      static Expression replace​(Expression expression, String substring, String repl, int n)
      Returned expression results in a string with at most n occurrences of substr replaced with repl.
      static Expression replace​(String expression, String substring, String repl)
      Returned expression results in a string with all occurrences of substr replaced with repl.
      static Expression replace​(String expression, String substring, String repl, int n)
      Returned expression results in a string with at most n occurrences of substr replaced with repl.
      static Expression rtrim​(Expression expression)
      Returned expression results in the string with all trailing white spaces removed.
      static Expression rtrim​(Expression expression, String characters)
      Returned expression results in the string with all trailing chars removed (any char in the characters string).
      static Expression rtrim​(String expression)
      Returned expression results in the string with all trailing white spaces removed.
      static Expression rtrim​(String expression, String characters)
      Returned expression results in the string with all trailing chars removed (any char in the characters string).
      static Expression split​(Expression expression)
      Returned expression results in a split of the string into an array of substrings separated by any combination of white space characters.
      static Expression split​(Expression expression, String sep)
      Returned expression results in a split of the string into an array of substrings separated by sep.
      static Expression split​(String expression)
      Returned expression results in a split of the string into an array of substrings separated by any combination of white space characters.
      static Expression split​(String expression, String sep)
      Returned expression results in a split of the string into an array of substrings separated by sep.
      static Expression substr​(Expression expression, int position)
      Returned expression results in a substring from the integer position to the end of the string.
      static Expression substr​(Expression expression, int position, int length)
      Returned expression results in a substring from the integer position of the given length.
      static Expression substr​(String expression, int position)
      Returned expression results in a substring from the integer position to the end of the string.
      static Expression substr​(String expression, int position, int length)
      Returned expression results in a substring from the integer position of the given length.
      static Expression title​(Expression expression)
      Returned expression results in the conversion of the string so that the first letter of each word is uppercase and every other letter is lowercase.
      static Expression title​(String expression)
      Returned expression results in the conversion of the string so that the first letter of each word is uppercase and every other letter is lowercase.
      static Expression trim​(Expression expression)
      Returned expression results in the string with all leading and trailing white spaces removed.
      static Expression trim​(Expression expression, String characters)
      Returned expression results in the string with all leading and trailing chars removed (any char in the characters string).
      static Expression trim​(String expression)
      Returned expression results in the string with all leading and trailing white spaces removed.
      static Expression trim​(String expression, String characters)
      Returned expression results in the string with all leading and trailing chars removed (any char in the characters string).
      static Expression upper​(Expression expression)
      Returned expression results in uppercase of the string expression.
      static Expression upper​(String expression)
      Returned expression results in uppercase of the string expression.
    • Method Detail

      • contains

        public static Expression contains​(Expression expression,
                                          String substring)
        Returned expression results in True if the string expression contains the substring.
      • contains

        public static Expression contains​(String expression,
                                          String substring)
        Returned expression results in True if the string expression contains the substring.
      • initCap

        public static Expression initCap​(Expression expression)
        Returned expression results in the conversion of the string so that the first letter of each word is uppercase and every other letter is lowercase.
      • initCap

        public static Expression initCap​(String expression)
        Returned expression results in the conversion of the string so that the first letter of each word is uppercase and every other letter is lowercase.
      • title

        public static Expression title​(Expression expression)
        Returned expression results in the conversion of the string so that the first letter of each word is uppercase and every other letter is lowercase.
      • title

        public static Expression title​(String expression)
        Returned expression results in the conversion of the string so that the first letter of each word is uppercase and every other letter is lowercase.
      • length

        public static Expression length​(Expression expression)
        Returned expression results in the length of the string expression.
      • length

        public static Expression length​(String expression)
        Returned expression results in the length of the string expression.
      • lower

        public static Expression lower​(Expression expression)
        Returned expression results in the given string expression in lowercase
      • lower

        public static Expression lower​(String identifier)
        Returned expression results in the string value for the given identifier, in lowercase
      • ltrim

        public static Expression ltrim​(Expression expression)
        Returned expression results in the string with all leading white spaces removed.
      • ltrim

        public static Expression ltrim​(String expression)
        Returned expression results in the string with all leading white spaces removed.
      • ltrim

        public static Expression ltrim​(Expression expression,
                                       String characters)
        Returned expression results in the string with all leading chars removed (any char in the characters string).
      • ltrim

        public static Expression ltrim​(String expression,
                                       String characters)
        Returned expression results in the string with all leading chars removed (any char in the characters string).
      • position

        public static Expression position​(Expression expression,
                                          String substring)
        Returned expression results in the first position of the substring within the string, or -1. The position is zero-based, i.e., the first position is 0.
      • position

        public static Expression position​(String expression,
                                          String substring)
        Returned expression results in the first position of the substring within the string, or -1. The position is zero-based, i.e., the first position is 0.
      • repeat

        public static Expression repeat​(Expression expression,
                                        int n)
        Returned expression results in the string formed by repeating expression n times.
      • repeat

        public static Expression repeat​(String expression,
                                        int n)
        Returned expression results in the string formed by repeating expression n times.
      • replace

        public static Expression replace​(Expression expression,
                                         String substring,
                                         String repl)
        Returned expression results in a string with all occurrences of substr replaced with repl.
      • replace

        public static Expression replace​(String expression,
                                         String substring,
                                         String repl)
        Returned expression results in a string with all occurrences of substr replaced with repl.
      • replace

        public static Expression replace​(Expression expression,
                                         String substring,
                                         String repl,
                                         int n)
        Returned expression results in a string with at most n occurrences of substr replaced with repl.
      • replace

        public static Expression replace​(String expression,
                                         String substring,
                                         String repl,
                                         int n)
        Returned expression results in a string with at most n occurrences of substr replaced with repl.
      • rtrim

        public static Expression rtrim​(Expression expression)
        Returned expression results in the string with all trailing white spaces removed.
      • rtrim

        public static Expression rtrim​(String expression)
        Returned expression results in the string with all trailing white spaces removed.
      • rtrim

        public static Expression rtrim​(Expression expression,
                                       String characters)
        Returned expression results in the string with all trailing chars removed (any char in the characters string).
      • rtrim

        public static Expression rtrim​(String expression,
                                       String characters)
        Returned expression results in the string with all trailing chars removed (any char in the characters string).
      • split

        public static Expression split​(Expression expression)
        Returned expression results in a split of the string into an array of substrings separated by any combination of white space characters.
      • split

        public static Expression split​(String expression)
        Returned expression results in a split of the string into an array of substrings separated by any combination of white space characters.
      • split

        public static Expression split​(Expression expression,
                                       String sep)
        Returned expression results in a split of the string into an array of substrings separated by sep.
      • split

        public static Expression split​(String expression,
                                       String sep)
        Returned expression results in a split of the string into an array of substrings separated by sep.
      • substr

        public static Expression substr​(Expression expression,
                                        int position,
                                        int length)
        Returned expression results in a substring from the integer position of the given length. The position is zero-based, i.e. the first position is 0. If position is negative, it is counted from the end of the string; -1 is the last position in the string.
      • substr

        public static Expression substr​(String expression,
                                        int position,
                                        int length)
        Returned expression results in a substring from the integer position of the given length. The position is zero-based, i.e. the first position is 0. If position is negative, it is counted from the end of the string; -1 is the last position in the string.
      • substr

        public static Expression substr​(Expression expression,
                                        int position)
        Returned expression results in a substring from the integer position to the end of the string. The position is zero-based, i.e. the first position is 0. If position is negative, it is counted from the end of the string; -1 is the last position in the string.
      • substr

        public static Expression substr​(String expression,
                                        int position)
        Returned expression results in a substring from the integer position to the end of the string. The position is zero-based, i.e. the first position is 0. If position is negative, it is counted from the end of the string; -1 is the last position in the string.
      • trim

        public static Expression trim​(Expression expression)
        Returned expression results in the string with all leading and trailing white spaces removed.
      • trim

        public static Expression trim​(String expression)
        Returned expression results in the string with all leading and trailing white spaces removed.
      • trim

        public static Expression trim​(Expression expression,
                                      String characters)
        Returned expression results in the string with all leading and trailing chars removed (any char in the characters string).
      • trim

        public static Expression trim​(String expression,
                                      String characters)
        Returned expression results in the string with all leading and trailing chars removed (any char in the characters string).
      • upper

        public static Expression upper​(Expression expression)
        Returned expression results in uppercase of the string expression.
      • upper

        public static Expression upper​(String expression)
        Returned expression results in uppercase of the string expression.