numere-org / NumeRe

Framework for numerical computations, data analysis and visualisation
https://www.numere.org
GNU General Public License v3.0
20 stars 7 forks source link

String functions for comparing first and last characters of a string #21

Closed numeredev closed 1 year ago

numeredev commented 1 year ago

DESCRIPTION

What does your feature request improve on? Please describe. Often it is necessary to detect, whether a string begins or ends with a specific substring. Although this can be done using substr() == STR, it is error prone if comparing the last characters of a string.

Describe the solution you'd like Provide two new functions beginswith(STR,STR) -> LOG and endswith(STR,STR) -> LOG, which shall detect, whether a stirng starts or ends with a corresponding string. Naming is up to discussion, of course.

Additional context Add any other context or screenshots about the feature request here.

(Do not write below this line)


DEVS' SECTION

ANALYSIS

Create the two function implementations in stringfunctions.hpp as STR_STR. As it is quite common to name the function for comparing the beginning of the string startswith(), we'll use this name as well.

IMPLEMENTATION STEPS

(see also our Wiki for implementation guidelines)

DOCUMENTATION STEPS

(see also our Wiki for further information)

PULL REQUEST