shave icon indicating copy to clipboard operation
shave copied to clipboard

Split by Delimiters Passed To Shave Function

Open CJames95 opened this issue 1 year ago • 5 comments

Proposed Changes

  • Adds support to allow users to pass the delimiters they want to use. This will allow users to determine how the string should be broken up for the purpose of truncating text.

CJames95 avatar Jun 03 '24 21:06 CJames95

This pull request is for #411 that I made. This was how I fixed it for my project.

CJames95 avatar Jun 03 '24 21:06 CJames95

@CJames95 thanks for the PR! I'll reach out in the issue you created.

yowainwright avatar Jun 03 '24 21:06 yowainwright

@CJames95 the demo you did was GREAT, and I'd love to get this feature in b/c it's a nice touch!!!

As it stands today, I'd like to make this feature so that the delimiter is drop-in replacement for ' '.

  • no extra iteration (no more while loops) and
  • no regex.

When this product was made, speed was key.

  • My concern with the regex is stack overflow.
  • My concern with the extra while loop is just a little less speed for customers who've been using shave for almost 10 years without the need for a delimiter.

Thank you! Happy to be enlightened on any ideas you have!

yowainwright avatar Jun 06 '24 23:06 yowainwright

@yowainwright I am not sure I quite understand what you mean by

As it stands today, I'd like to make this feature so that the delimiter is drop-in replacement for ' '.

As far as you're concerns for Regex and any additional loops, that makes complete sense. This demo was a quick fix to a problem my team and I encountered and needed to solve.

Admittedly though, I'm not entirely sure how to accomplish this under the constraints at the moment, but I'll look into this more and see if I can come up with some alternatives.

CJames95 avatar Jun 07 '24 14:06 CJames95

@CJames95 I can look too! ...Might be a little bit but great work here! THANK YOU! I just want to ensure this nice feature doesn't affect other users. 🙌

yowainwright avatar Jun 10 '24 08:06 yowainwright