dartx icon indicating copy to clipboard operation
dartx copied to clipboard

Add String.splitAt(index)

Open passsy opened this issue 1 year ago • 0 comments

Proposal:

Add a splitAt method to String extensions. This method splits a string into two parts at the specified index.

API:

List<String> splitAt(int index);

Example:

final result = "hello".splitAt(2);
// result: ["he", "llo"]

// Example with destructuring
final [firstPart, secondPart] = "hello".splitAt(2);
// firstPart: "he"
// secondPart: "llo"

passsy avatar Dec 19 '24 06:12 passsy