t9165.nim 292 B

1234567891011
  1. type ustring = distinct string
  2. converter toUString(s: string): ustring = ustring(s)
  3. converter toString(s: ustring): string = string(s)
  4. proc `[]=`*(s: var ustring, slice: Slice[int], replacement: ustring) {.inline.} =
  5. s = replacement
  6. var s = ustring("123")
  7. s[1..2] = "3"
  8. doAssert s == "3"