#34 StringUtils.substr

Stängd
öppnade 4 år sedan av ranides · 0 kommentarer
ranides kommenterad 4 år sedan

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)`
ranides refererade till detta ärende från en incheckning 4 år sedan
Logga in för att delta i denna konversation.
Ingen Milsten
Ingen förvärvare
1 Deltagare
Laddar...
Avbryt
Spara
Det finns inget innehåll än.