Siddhi Execution String
======================================

  [![Jenkins Build Status](https://wso2.org/jenkins/job/siddhi/job/siddhi-execution-string/badge/icon)](https://wso2.org/jenkins/job/siddhi/job/siddhi-execution-string/)
  [![GitHub Release](https://img.shields.io/github/release/siddhi-io/siddhi-execution-string.svg)](https://github.com/siddhi-io/siddhi-execution-string/releases)
  [![GitHub Release Date](https://img.shields.io/github/release-date/siddhi-io/siddhi-execution-string.svg)](https://github.com/siddhi-io/siddhi-execution-string/releases)
  [![GitHub Open Issues](https://img.shields.io/github/issues-raw/siddhi-io/siddhi-execution-string.svg)](https://github.com/siddhi-io/siddhi-execution-string/issues)
  [![GitHub Last Commit](https://img.shields.io/github/last-commit/siddhi-io/siddhi-execution-string.svg)](https://github.com/siddhi-io/siddhi-execution-string/commits/master)
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

The **siddhi-execution-string extension** is a <a target="_blank" href="https://siddhi.io/">Siddhi</a> extension that provides basic string handling capabilities such as concat, length, replace all, etc.

For information on <a target="_blank" href="https://siddhi.io/">Siddhi</a> and it's features refer <a target="_blank" href="https://siddhi.io/redirect/docs.html">Siddhi Documentation</a>. 

## Download

* Versions 5.x and above with group id `io.siddhi.extension.*` from <a target="_blank" href="https://mvnrepository.com/artifact/io.siddhi.extension.execution.string/siddhi-execution-string/">here</a>.
* Versions 4.x and lower with group id `org.wso2.extension.siddhi.*` from <a target="_blank" href="https://mvnrepository.com/artifact/org.wso2.extension.siddhi.execution.string/siddhi-execution-string">here</a>.

## Latest API Docs 

Latest API Docs is <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13">5.0.13</a>.

## Features

* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#groupconcat-aggregate-function">groupConcat</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#aggregate-function">Aggregate Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">This function aggregates the received events by concatenating the keys in those events using a separator, e.g.,a comma (,) or a hyphen (-), and returns the concatenated key string.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#charat-function">charAt</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">This function returns the 'char' value that is present at the given index position. of the input string.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#charfrequency-function">charFrequency</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Gives the frequency of a char in <code>input string</code>.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#coalesce-function">coalesce</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;"> This returns the first input parameter value of the given argument, that is not null.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#concat-function">concat</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">This function returns a string value that is obtained as a result of concatenating two or more input string values.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#contains-function">contains</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">This function returns <code>true</code> if the<code>input.string</code> contains the specified sequence of char values in the <code>search.string</code>. </p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#equalsignorecase-function">equalsIgnoreCase</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">This returns a boolean value by comparing two strings lexicographically without considering the letter case.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#filltemplate-function">fillTemplate</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">fillTemplate(string, map) will replace all the keys in the string using values in the map. fillTemplate(string, r1, r2 ..) replace all the entries {{1}}, {{2}}, {{3}} with r1 , r2, r3.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#hex-function">hex</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">This function returns a hexadecimal string by converting each byte of each character in the input string to two hexadecimal digits.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#length-function">length</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Returns the length of the input string.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#locate-function">locate</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">This function returns the position of one string within another. Optionally, the user can give the starting index to be search from.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#lower-function">lower</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Converts the capital letters in the input string to the equivalent simple letters.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#regexp-function">regexp</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Returns a boolean value based on the matchability of the input string and the given regular expression.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#repeat-function">repeat</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Repeats the input string for a specified number of times.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#replaceall-function">replaceAll</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Finds all the substrings of the input string that matches with the given expression, and replaces them with the given replacement string.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#replacefirst-function">replaceFirst</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Finds the first substring of the input string that matches with the given regular expression, and replaces itwith the given replacement string.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#reverse-function">reverse</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Returns the input string in the reverse order character-wise and string-wise.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#split-function">split</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Splits the  <code>input.string</code> into substrings using the value parsed in the <code>split.string</code> and returns the substring at the position specified in the <code>group.number</code>.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#strcmp-function">strcmp</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Compares two strings lexicographically and returns an integer value. If both strings are equal, 0 is returned. If  the first string is lexicographically greater than the second string, a positive value is returned. If the first string is lexicographically greater than the second string, a negative value is returned.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#substr-function">substr</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Returns a substring of the input string by considering a subset or all of the following factors: starting index, length, regular expression, and regex group number.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#trim-function">trim</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Returns a copy of the input string without the leading and trailing whitespace (if any).</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#unhex-function">unhex</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Returns a string by converting the hexadecimal characters in the input string.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#upper-function">upper</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#function">Function</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">Converts the simple letters in the input string to the equivalent capital/block letters.</p></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-execution-string/api/5.0.13/#tokenize-stream-processor">tokenize</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#stream-processor">Stream Processor</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">This function splits the input string into tokens using a given regular expression and returns the split tokens.</p></p></div>

## Dependencies 

There are no other dependencies needed for this extension. 

## Installation

For installing this extension on various siddhi execution environments refer Siddhi documentation section on <a target="_blank" href="https://siddhi.io/redirect/add-extensions.html">adding extensions</a>.

## Support and Contribution

* We encourage users to ask questions and get support via <a target="_blank" href="https://stackoverflow.com/questions/tagged/siddhi">StackOverflow</a>, make sure to add the `siddhi` tag to the issue for better response.

* If you find any issues related to the extension please report them on <a target="_blank" href="https://github.com/siddhi-io/siddhi-execution-string/issues">the issue tracker</a>.

* For production support and other contribution related information refer <a target="_blank" href="https://siddhi.io/community/">Siddhi Community</a> documentation.
