2

I've looked into the underscore for drop/cut, but this only seems to remove the first or last n entries, not characters. Any ideas?

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
Anna
  • 825
  • 1
  • 11
  • 19

2 Answers2

2

Depends on what you're using drop cut on. Can you provide an example of your values?

Below shows how cut can be used on a sting and then a list of strings. It uses each right to drop a value from each item. http://code.kx.com/q/ref/adverbs/#each-right

q)1_"12456789"
"2456789"
q)
q)1_("12456789";"12456789")
"12456789"
q)
q)1_/:("12456789";"12456789")
"2456789"
"2456789"
emc211
  • 1,369
  • 7
  • 14
  • Thanks emc211! I'm not sure how to replicate data for kdb, but I've got a table and each entry in one of my columns looks like this: "NVC CN". So I want to remove the rightmost three characters from each entry in my table – Anna Jul 18 '17 at 15:44
1

@Connor Gervin had almost what I wanted, but if you want to cast back to a string, you can use `$(-3)_'string sym from tab

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
Anna
  • 825
  • 1
  • 11
  • 19