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

Add String.stripMargin #30864

Open
floitschG opened this issue Sep 22, 2017 · 1 comment
Open

Add String.stripMargin #30864

floitschG opened this issue Sep 22, 2017 · 1 comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-l library-core type-enhancement A request for a change that isn't a bug

Comments

@floitschG
Copy link
Contributor

Similar to other languages, although we probably want to just remove all indentation when no margin character is given.

var x = """
  foo() {
    xyz;
  }""".stripMargin();
print(x):

yields:

foo() {
  xyz;
}

With margin character:

var x = """
  |foo() {
  |  xyz;
  |}""".stripMargin("|");
print(x):

or:

var x = """foo() {
          |  xyz;
          |}""".stripMargin("|");
print(x):

Both of these yield the same result.

@floitschG floitschG added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-l library-core labels Sep 22, 2017
@lrhn lrhn added the type-enhancement A request for a change that isn't a bug label Sep 30, 2020
@lrhn
Copy link
Member

lrhn commented Mar 11, 2021

Not sure this fits into the core libraries. There are many things you can do to format lines of text, and this one is probably a little too specific (and primarily prompted by our less than than adequate multiline string literals - would be better to just change the multiline string literal to remove shared margins to begin with).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-l library-core type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants