dictu-lang / Dictu

Dictu is a high-level dynamically typed, multi-paradigm, interpreted programming language.
https://dictu-lang.com
MIT License
268 stars 53 forks source link

add findLast string method #723

Closed briandowns closed 8 months ago

briandowns commented 8 months ago

What's Changed:

Add lastIndexOf string method to find the last index of a given string in another string.

Type of Change:

#

Housekeeping:

#

Screenshots (If Applicable):

Jason2605 commented 8 months ago

Thanks for this! Would it be possible to maybe change the name to findLast? Just thinking to keep it consistent with the forward looking .find(). Thinking as well (potentially a later PR) if we also want the optional skip like we have with .find()

briandowns commented 8 months ago

Thanks for the review. Changes made. I can do the optional skip in another PR.

Jason2605 commented 8 months ago

Thanks for this!

briandowns commented 8 months ago

Thanks for that commit. Apparently my editor's find and replace isn't quite working as expected. I needed this method for a text wrap module I wrote over the weekend. It's super small in Dictu but a pain to do it in C. Do we want to entertain string methods in Dictu like we have with lists and dicts?

Jason2605 commented 8 months ago

No worries! Yeah built in methods on strings are more than welcome additions

briandowns commented 8 months ago

Awesome. Thanks!