Skip to content
UniKit

List range slicer

Slice every line of a list by a position range — 1-based and inclusive on both ends, with a “to end of line” switch that ignores the end position, counted in Unicode code points so Chinese characters and emoji stay intact.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

List

Slice result

One item per line, inclusive on both ends, counted by code points.

Paste a list and a range to slice every line

Lines: 0 · Changed: 0 · Characters kept: 0 · Characters removed: 0

What this tool does

  • Carve a middle segment out of fixed-width records, e.g. the date part of an order number.
  • Tidy exports by keeping only characters 2 to 5 of each line so the columns line up.
  • Combine with “to end of line” for two shapes: a fixed range, or everything from a position onwards.

Example

Input

abcdefgh
12345678

Output

bcde
2345

Positions 2 to 5 inclusive: abcdefgh becomes bcde and 12345678 becomes 2345.

Frequently asked questions

Are positions 1-based or 0-based?

1-based, matching “the nth character”. 0 or a negative value is rejected. The range is inclusive: start 2 and end 4 yields characters 2, 3 and 4 — three characters.

What if the end position is smaller than the start?

It reports an error instead of silently returning nothing. If you want “from a position to the end of the line”, tick “To end of line” — the end position is then ignored and may be smaller.

What if the start position is past the end of the line?

The line yields an empty result and is then dropped as a blank line; no error and no padding. One range therefore works for rows of different lengths, and the kept-character counter only counts real output.

How are Chinese characters counted?

One Chinese character is 1 and one emoji is 1, because counting walks Unicode code points, so nothing is split in half. Composite emoji such as skin-tone variants count as several code points.

Keywords:按位置截取区间截取substring rangeslice lines取第几到第几位文本行截取list slice行区间

Related tools