[
https://issues.apache.org/jira/browse/METRON-1168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16159589#comment-16159589
]
ASF GitHub Bot commented on METRON-1168:
----------------------------------------
Github user cestella commented on a diff in the pull request:
https://github.com/apache/metron/pull/742#discussion_r137913443
--- Diff:
metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/StringFunctions.java
---
@@ -321,6 +321,46 @@ public Object apply(List<Object> args) {
}
}
+ @Stellar( name="SUBSTRING"
+ , description = "Returns a substring of a string"
+ , params = {
+ "input - The string to take the substring of",
+ "start - The starting position (0-based and inclusive)",
+ "end? - The ending position (0-based and exclusive)"
+ }
+ , returns = "The substring of the input"
+ )
+ public static class Substring extends BaseStellarFunction {
+
+ @Override
+ public Object apply(List<Object> strings) {
+
+ if(strings == null || strings.size() < 2 ) {
+ throw new IllegalArgumentException("[SUBSTRING] required 2
arguments: the input and the start position (inclusive)");
+ }
+ String var = strings.get(0) == null?null: (String) strings.get(0);
+ Integer start = strings.get(1) == null?null:(Integer)strings.get(1);
--- End diff --
Agreed
> Add SUBSTRING method to stellar
> -------------------------------
>
> Key: METRON-1168
> URL: https://issues.apache.org/jira/browse/METRON-1168
> Project: Metron
> Issue Type: New Feature
> Reporter: Casey Stella
>
> Add SUBSTRING function to stellar.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)