Skip to content

Implement std.trim for string#684

Merged
sparkprime merged 5 commits intogoogle:masterfrom
Tejesh-Raut:string-trim
Jun 13, 2023
Merged

Implement std.trim for string#684
sparkprime merged 5 commits intogoogle:masterfrom
Tejesh-Raut:string-trim

Conversation

@Tejesh-Raut
Copy link
Copy Markdown
Contributor

@Tejesh-Raut Tejesh-Raut commented Apr 14, 2023

Add std.trim function in standard library.

PR for cpp-jsonnet: google/jsonnet#1067

@Tejesh-Raut
Copy link
Copy Markdown
Contributor Author

Tests added in this PR are working fine. Not sure why 2 other checks are failing. Can someone help here?

Comment thread builtins.go
return nil, err
}
sStr := str.getGoString()
return makeValueString(strings.TrimSpace(sStr)), nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be compatible with C++, this should be strings.Trim with explicit " \t" I think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strings.TrimSpace removes all kinds of spaces '\t', '\n', '\v', '\f', '\r', ' ', U+0085 (NEL), U+00A0 (NBSP).

@sparkprime
Copy link
Copy Markdown
Contributor

I think the tests will work if you rebase.

@coveralls
Copy link
Copy Markdown

coveralls commented May 16, 2023

Coverage Status

Coverage: 68.52% (+0.03%) from 68.493% when pulling 7b87efa on Tejesh-Raut:string-trim into 44538a3 on google:master.

@sparkprime sparkprime merged commit fae8411 into google:master Jun 13, 2023
vhata pushed a commit to discord/go-jsonnet that referenced this pull request Aug 30, 2024
* Implement std.trim for string
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

Successfully merging this pull request may close these issues.

3 participants