[
https://issues.apache.org/jira/browse/METRON-830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15964963#comment-15964963
]
ASF GitHub Bot commented on METRON-830:
---------------------------------------
Github user mattf-horton commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/516#discussion_r111012694
--- Diff: metron-platform/metron-common/README.md ---
@@ -167,6 +172,14 @@ The `!=` operator is the negation of the above.
| [ `WEEK_OF_YEAR`](#week_of_year)
|
| [ `YEAR`](#year)
|
+### `APPEND_IF_MISSING`
+ * Description: Appends the suffix to the end of the string if the string
does not already end with any of the suffixes.
+ * Input:
+ * string - The string to be appended.
+ * suffix - The string suffix to append to the end of the string.
+ * suffixes - Optional - Additional string suffixes that are valid
terminators.
--- End diff --
Ah, got it. The documentation you point at for apache commons
PrependIfMission method actually uses signature:
```
CharSequence... suffixes
```
so it is a varargs usage. You can do the same with Stellar, or we have
found it better to allow a list of strings instead (which you would explode
into the calling varargs in the java code). Using a list instead of varargs
makes it much easier to extend the function later if we choose.
It's up to you whether to do this now. We are trying to close a RC, so
there is some time pressure. Maybe you should just open a jira to enhance this
later with a list arg.
The current implementation of your call to PrependIfMissing is such that
the "additionalsuffix" description you suggest would be correct.
> Adding StringFunctions to Stellar - chop, prependifmissing, appendifmissing
> and countmatches
> --------------------------------------------------------------------------------------------
>
> Key: METRON-830
> URL: https://issues.apache.org/jira/browse/METRON-830
> Project: Metron
> Issue Type: Bug
> Affects Versions: 0.3.1
> Reporter: Anand Subramanian
> Assignee: Anand Subramanian
> Fix For: Next + 1
>
>
> Enhance Stellar by adding the following apache common string functions.
> - chop -> Remove the last character from a String.
> - prependifmissing -> Prepends the prefix to the start of the string if the
> string does not already start with any of the prefixes.
> - appendifmissing -> Appends the suffix to the end of the string if the
> string does not already end with any of the suffixes.
> - countmatches -> Counts how many times the substring appears in the larger
> string.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)