#34 StringUtils.substr

已關閉
ranides4 年之前創建 · 0 條評論

Make method: substr(begin, length) which accepts negative indexes.

  • negative begin is counted from the end of string.
  • negative length is subtracted from length of string

Two arguments:

  • example: make string a bit shorter: .substr(0, -2)
  • example: extract last 3 characters: .substr(-3, 3)

Short version:

  • example: extract first 3 characters: .substr(3)
  • example: extract last 3 characters: .substr(-3)
Make method: `substr(begin, length)` which accepts negative indexes. - negative `begin` is counted from the end of string. - negative `length` is subtracted from length of string Two arguments: - example: make string a bit shorter: `.substr(0, -2)` - example: extract last 3 characters: `.substr(-3, 3)` Short version: - example: extract first 3 characters: `.substr(3)` - example: extract last 3 characters: `.substr(-3)`
ranides4 年之前 關閉
ranides 在代碼提交 4 年之前 中引用了該問題
登入 才能加入這對話。
未選擇里程碑
未指派成員
1 參與者
正在加載...
取消
保存
尚未有任何內容