Qurak

Shortest

ใช้งานได้ แตกต่างจากเอกสารอ้างอิง .wl

Pattern wrapper that tries the shortest match first — the default for both string and expression sequences

Shortest[p]
{a, b, c, d, e, f, g} /. {x__, Shortest[y__]} :> {{x}, {y}} → {{a}, {b, c, d, e, f, g}}{a, b, c, d, e, f, g} /. {Shortest[x__], y__} :> {{x}, {y}} → {{a}, {b, c, d, e, f, g}}StringCases["abcdefg", Shortest[x__] ~~ __ -> x] → {a}

หัวข้อ

ที่เกี่ยวข้อง

ฟังก์ชันทั้งหมด 6300 รายการ · ใช้สิ่งนี้จากไคลเอนต์ MCP