Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keepAfter, keepBefore, keepBetween, keepChars #62

Open
okabak123 opened this issue Feb 22, 2023 · 0 comments
Open

keepAfter, keepBefore, keepBetween, keepChars #62

okabak123 opened this issue Feb 22, 2023 · 0 comments

Comments

@okabak123
Copy link

okabak123 commented Feb 22, 2023

Hi, this is a feature suggestion to this awesome library.

The suggested functions are as follows:

  • keepAfter(text, after_string, instance_num*)
  • keepBefore(text, before_string, instance_num*)
  • keepBetween(text, keep_start, keep_end)
  • keepChars(text, keep_string)

*optional arguments

These are inspired by a program called EasyMorph. And for more info I'll link to their documentation.

keepAfter

This function returns characters after the first occurrence of after_string in text, if found. If after_string is not found within text and "empty" value is returned.

keepAfter('a/b/c/d', 'b') //Returns '/c/d'

More info

keepBefore

This function returns characters before the first occurrence of before_string in text, if found. If before_string is not found within text and "empty" value is returned.

keepBefore('5pm', 'pm') //Returns '5'

More info

keepBetween

This function returns the characters between the first occurrence of keep_start and the first occurrence of keep_end in text.

keepBetween('Mary Joe Smith', 'Mary ', ' Smith') //Returns 'Joe'

More info

keepChars

This function keeps only the characters given in keep_string and removes the others from text.

keepChars('a1b2c3', 'abc') //Returns 'abc'

More info

@okabak123 okabak123 changed the title keepAfter, keepBefore, keepBetween, keepAfter, keepBefore, keepBetween, keepChars Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant