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

Add new string functions #178

Open
moshekaplan opened this Issue Sep 20, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@moshekaplan
Copy link
Contributor

moshekaplan commented Sep 20, 2018

Picking up BIT-1754 again:

List of functions to implement:

  • str.count - Return the number of non-overlapping occurrences of substring sub in the range
  • str.find - Return the lowest index in the string where substring sub is found within the slice s[start:end].
  • str.lstrip - Return a copy of the string with leading characters removed. The chars argument is a string specifying the set of characters to be removed.
  • str.rfind - Return the highest index in the string where substring sub is found
  • str.rstrip - Return a copy of the string with trailing characters removed. The chars argument is a string specifying the set of characters to be removed
  • str.strip - Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed

Notes from @sethhall

We'd merge these in if you implemented them. Are you still planning on doing so? I have a couple of notes too...

  • count can be done with the built in find_all function
  • find can currently be implemented with the built in strstr function.
  • lstrip, rstrip, can be implement with the sub function.
@spitfire55

This comment has been minimized.

Copy link
Contributor

spitfire55 commented Oct 16, 2018

If nobody is currently working on this, I'm going to write a bunch of string BiFs this week. Here is the list of functions I'll start tackling (inspired by Python string functions):

  • str.rfind
  • str.rstrip
  • str.lstrip
    • I see the notes above about sub being able to do lstrip and rstrip. I think this will be more clear/intuitive, even if its potentially redundant.
  • str.endswith
  • str.isnum
  • str.isalpha
  • str.isalnum
  • str.ljust
  • str.rjust
  • str.swapcase
  • str.to_title
  • str.zfill
@moshekaplan

This comment has been minimized.

Copy link
Contributor

moshekaplan commented Oct 16, 2018

You're welcome to take it over. I've already implemented find and count, in case that helps: string_funcs.diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment