Handlebars-Net / Handlebars.Net.Helpers

Handlebars.Net helpers in the categories: 'Boolean', 'Constants', 'Enumerable', 'Environment', 'Math', 'Regex', 'String', 'DateTime' and 'Url'.
MIT License
38 stars 14 forks source link

Adding further String helpers #74

Closed Andras-Csanyi closed 1 year ago

Andras-Csanyi commented 1 year ago

Hi All,

I'm using this package and I like it very much, however, I miss the String.Substring helper. Should I feel free to open a pull request containing this helper? Is there anything I need to be aware of which is contribution related beside the usual things? Usual things: clone the repo, create your branch, make your changes, test them and open the PR, etc...

StefH commented 1 year ago

@Andras-Csanyi Yes you can add this, also add a unit test to test the helper itself and to test the helper in a template.

StefH commented 1 year ago

@Andras-Csanyi If you have time, you can copy here the markdown for the changes for the wiki page: https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/String

Andras-Csanyi commented 1 year ago

@Andras-Csanyi If you have time, you can copy here the markdown for the changes for the wiki page: https://github.com/Handlebars-Net/Handlebars.Net.Helpers/wiki/String

Ok, I'll do it later today. Thanks!

Andras-Csanyi commented 1 year ago

The doc part:

Substring

Summary Retrieves a substring from the original string
Returns Substring portion
Remarks Behavior of parameters follows String.Substring() behavior
Parameters
str Base string
start Start position of the substring
length Length of the string (optional)

Example

Context

{
    "value": "Lorem ipsum dolor sit amet"
}

Usage

<strong>result:</strong>
{{String.Substring value 1 3}}
{{String.Substring "Lorem" 1 }}

Returns


<strong>result:</strong>
ore
orem