String Manipulation Functions #21
-
|
I think a Here are string manipulation functions that are available in the programming languages that underlay the various popular JMESPath implementations:
Note that JMESPath already implements the following string manipulation functions:
We plan to propose expanding slices to operate on string types. Please, note that JMESPath already implements SpecificationSome string manipulation functions bring the new concept of optional arguments to JMESPath functions. The specification paragraph on function evaluation must thus be changed accordingly – highlighted in bold in the text below: Functions can References |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 8 replies
-
|
Some additional functions:
An alternative to pad_*, upper, lower, and title could be a format() function that takes a format string with various formatting codes / syntax that include these manipulations. I think the Python format string syntax is worth adopting. It allows for parametrization of the placeholders within the format string. This opens the doors to extensibility over creating additional string manipulation functions.. |
Beta Was this translation helpful? Give feedback.
-
|
This is a JEP fragment that specifies the SpecificationlowerReturns the lowercase Examples
upperReturns the uppercase
HistoryN/A |
Beta Was this translation helpful? Give feedback.
-
|
This is a JEP fragment that specifies the SpecificationtrimGiven the The Examples
trim_leftGiven the Like for the Examples
trim_rightGiven the Like for the Examples
HistoryN/A |
Beta Was this translation helpful? Give feedback.
-
|
This is a JEP fragment that specifies the SpecificationreplaceGiven the The The Examples
HistoryN/A |
Beta Was this translation helpful? Give feedback.
-
|
This is a JEP fragment that specifies the Specificationpad_leftGiven the The The Examples
pad_rightGiven the The The Examples
History
|
Beta Was this translation helpful? Give feedback.
-
|
This is a JEP fragment that specifies the Specificationfind_firstGiven the The
Examples
find_lastGiven the The If this parameter is omitted, It defaults to
HistoryN/A |
Beta Was this translation helpful? Give feedback.
-
|
This is a JEP fragment that specifies the SpecificationsplitGiven string The The If Otherwise, the Examples
History
|
Beta Was this translation helpful? Give feedback.
-
|
The string manipulation functions are supported in the preview page. |
Beta Was this translation helpful? Give feedback.
-
String Functions
AbstractThis JEP introduces a core set of useful string manipulation functions. Those functions are modeled from functions found in popular programming languages such as JavaScript and Python. Specificationfind_firstGiven the The
Contrary to similar functions found in most popular programming languages, the Examples
find_lastGiven the The If this parameter is omitted, It defaults to Likewise, the
lowerReturns the lowercase Examples
pad_leftGiven the The The Examples
pad_rightGiven the The The Examples
replaceGiven the The The Examples
splitGiven string The The If Otherwise, the Note: The Examples
SpecificationtrimGiven the The Examples
trim_leftGiven the Like for the Examples
trim_rightGiven the Like for the Examples
upperReturns the uppercase
ComplianceA new |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the proposal @springcomp. Can we also add a For example, the lower case of // this is Javascript
'ß'.toLowerCase() == 'ss'.toLowerCase() // this is false
'ß'.localeCompare('ss', undefined, { sensitivity: 'base' }) // this is 0, they are the same with case insensitive comparison |
Beta Was this translation helpful? Give feedback.
-
|
Hi, |
Beta Was this translation helpful? Give feedback.
-
|
I propose to add a regex operator, to allow to use the power of regex: Match operatorGiven the
|
Beta Was this translation helpful? Give feedback.
String Functions
Abstract
This JEP introduces a core set of useful string manipulation functions. Those functions are modeled from functions found in popular programming languages such as JavaScript and Python.
Specification
find_first
Given the
$subjectstring,find_first()returns the index of the first occurence where the$subsubstring appears in$subjectornull.The
$startand$endparameters are optional and allow to select wherefind_first()must perform its …