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 var methods for front and back #20

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 access the very first or very last character of a string. Using STR.at() is tedious here.

Describe the solution you'd like Create two new methods STR.front and STR.back to access the very first and very last character in the corresponding string.

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

(Do not write below this line)


DEVS' SECTION

ANALYSIS

This requires inserting the logic in void replaceStringMethod(string& sLine, size_t nPos, size_t nLength, const string& sReplacement) similar to STRVAR.len. To achieve this, create the corresponding stringfunctions to redirect the logic. Name those functions firstch(STR) and lastch(STR) and the methods also possibly STR.first and STR.last.

Keep in mind that the current string might be empty (then return an empty string). Add also the necessary documentation.

IMPLEMENTATION STEPS

(see also our Wiki for implementation guidelines)

DOCUMENTATION STEPS

(see also our Wiki for further information)

PULL REQUEST