This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
Implement SUBSTRING(string, start, length) function #42
Labels
enhancement
New feature or request
Comments
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.
No description provided.
The text was updated successfully, but these errors were encountered: