You are given a multiline string
You need to produce the resulting string
-
It does not have any content from the
$source$ lines whose zero-based line numbers$i < startLine$ or$i > endLine$ . -
It contains the lines at indices
$i$ such that$startLine \le i \le endLine$ , transformed by trimming the shortest
common indentation (whitespace prefix) that they all have.Example: for the
$source$ given below and$startLine = 1$ ,$endLine = 3$ :foo { bar { x = 1 } y = 2 }
The expected
$result$ is:bar { x = 1 }
For the same
$source$ and$startLine = endLine = 2$ the expected$result$ would be:x = 1
Performance:
Once you have the
For each of the requests, you need to produce an index
In this example, there is a single request, and its <here>
in
bar {
x = <here>1
}
The expected <here>
:
foo {
bar {
x = <here>1
}
y = 2
}
Performance: