Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Implement SUBSTRING(string, start, length) function #42

Closed
ajnavarro opened this issue Feb 26, 2018 · 0 comments
Closed

Implement SUBSTRING(string, start, length) function #42

ajnavarro opened this issue Feb 26, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ajnavarro
Copy link
Contributor

No description provided.

@ajnavarro ajnavarro added the enhancement New feature or request label Feb 26, 2018
@ajnavarro ajnavarro mentioned this issue Feb 26, 2018
14 tasks
@erizocosmico erizocosmico self-assigned this Feb 26, 2018
erizocosmico added a commit to erizocosmico/go-mysql-server that referenced this issue Feb 26, 2018
Fixes src-d#42
This PR implements the substring(str, start, length) function with the following rules:
- negative start or length causes an error.
- start bigger or equal to str length causes an error.
- valid start with 0 length returns the empty string.
- null string returns null.
Since Go strings are UTF8, this function does not return a direct substring str[start:start+length], instead returns the substring of runes. That is, "á"[0:1] does not return a partial unicode glyph, but "á" itself.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
erizocosmico added a commit to erizocosmico/go-mysql-server that referenced this issue Feb 26, 2018
Fixes src-d#42
This PR implements the substring(str, start, length) function with the following rules:
- negative start or length causes an error.
- start bigger or equal to str length causes an error.
- valid start with 0 length returns the empty string.
- null string returns null.
Since Go strings are UTF8, this function does not return a direct substring str[start:start+length], instead returns the substring of runes. That is, "á"[0:1] does not return a partial unicode glyph, but "á" itself.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
erizocosmico added a commit to erizocosmico/go-mysql-server that referenced this issue Feb 26, 2018
Fixes src-d#42
This PR implements the substring(str, start, length) function with the following rules:
- negative start or length causes an error.
- start bigger or equal to str length causes an error.
- valid start with 0 length returns the empty string.
- null string returns null.
Since Go strings are UTF8, this function does not return a direct substring str[start:start+length], instead returns the substring of runes. That is, "á"[0:1] does not return a partial unicode glyph, but "á" itself.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
erizocosmico added a commit to erizocosmico/go-mysql-server that referenced this issue Feb 27, 2018
Fixes src-d#42
This PR implements the substring(str, start[, length]) function with the same behaviour as its homonym MySQL function.
Since Go strings are UTF8, this function does not return a direct substring str[start:start+length], instead returns the substring of runes. That is, "á"[0:1] does not return a partial unicode glyph, but "á" itself.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants