Search

9.9. String functions

download PDF
The following are string functions you can use.

9.9.1. isinstr

General syntax:
isinstr:long (s1:string, s2:string)
This function returns 1 if string s1 contains string s2, otherwise zero.

9.9.2. strlen

General syntax:
strlen:long (str:string)
This function returns the number of characters in str.

9.9.3. strtol

General syntax:
strtol:long (str:string, base:long)
This function converts the string representation of a number to an integer. The base parameter indicates the number base to assume for the string (e.g. 16 for hex, 8 for octal, 2 for binary).

9.9.4. substr

General syntax:
substr:string (str:string, start:long, stop:long)
This function returns the substring of str starting from character position start and ending at character position stop.

9.9.5. text_str

General syntax:
text_str:string (input:string)
This function accepts a string argument. Any ASCII characters in the string that are not printable are replaced by a corresponding escape sequence in the returned string.

9.9.6. text_strn

General syntax:
text_strn:string (input:string, len:long, quoted:long)
This function accepts a string of length len. Any ASCII characters that are not printable are replaced by a corresponding escape sequence in the returned string. If quoted is not null, the function adds a backslash character to the output.

9.9.7. tokenize

General syntax:
tokenize:string (input:string, delim:string)
This function returns the next non-empty token in the given input string, where the tokens are delimited by characters in the delim string. If the input string is non-NULL, it returns the first token. If the input string is NULL, it returns the next token in the string passed in the previous call to tokenize. If no delimiter is found, the entire remaining input string is returned. It returns NULL when no more tokens are available.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.