Skip to content

Add String.stripMarginΒ #30864

@floitschG

Description

@floitschG

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.core-llibrary-coretype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions