Home > Mobile >  Is there a way to copy a single line of code but have it incrementally increase a number in said lin
Is there a way to copy a single line of code but have it incrementally increase a number in said lin

Time:01-21

I have a line of code I want to mass-paste into a file.

The line of code is "enchantment.level.x": "string". I want to paste this multiple times into my program, but each time I paste the line, I want x to increase by one.

So if line 2000 is "enchantment.level.1": "I", I would want line 2001 to be "enchantment.level.2": "I" (but I would change "I" to "II" manually).

Is there a way I can achieve this? Thank you

CodePudding user response:

I don't think there is any way to do what you want on each paste. But if you make all your pastes first then you can @rioV8's or my extension to accomplish the same goal.

The extension is matchNumber replace

${matchNumber} starts at 1. ${matchIndex} starts at 0.

CodePudding user response:

You can use the extension Regex Text Generator to generate the new numbers.

  • Paste the line as often as you like
  • Select the number on all the lines with Multiple Cursors
  • use the extension and use (.*) for match regex and {{=i 1}} for generator expression
  •  Tags:  
  • Related