dart-lang / dart-lang/language

Introduce ability to remove leading indents in a multiline string after a newline.

Open
#559 8 comments 42 reactions 0 assignees View on GitHub
request
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

In dart if I create a multiline string like this:
```dart
String itemList = """
1. Item A
2. Item B
3. Item C
""";
```

I expect the output of `print(itemList)` to be as:
```
1. Item A
2. Item B
3. Item C
```

But the actual output comes out to be:
```
1. Item A
2. Item B
3. Item C
```

It would be helpful to introduce a method called `itemList.trimLeadingIndents()` that would give us the output as expected after removing the indents after every newline character.

I would like to contribute fixing this issue and providing a method but before that if the community can approve if they would like to have such method in the `Dart` language.

Any help would be appreciable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.