Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ numbering an array

Tags:

notepad++

Is that possible to create an ordered list of arrays in Notepad++ using the following:

array[] =
array[] =
array[] =
array[] = 
array[] =
...

and obtain the following...

array[0] =
array[1] =
array[2] =
array[3] =
array[4] =
...

Thanks.

EDIT:
What I am actually wondering is, is there a practical way of doing it (by using replace all feature of Notepad++) using Notepad++. Not any other programming language. It is basically replace all [] symbols with ordered numbers in them.

like image 521
polerto Avatar asked May 20 '11 13:05

polerto


2 Answers

Directly in notepad++ :

  1. put your cursor between the two []
  2. Press ALT to use column editing mode and go the last row with the mouse
  3. Press simultaneously ALT + C to open Column / Multi Selection editor
  4. Fill "Number to insert" with 0 to n and press OK

It's done !!

like image 106
Grumly75 Avatar answered Oct 25 '22 02:10

Grumly75


I was not able to find a practical way of doing it in Notepad++ but there is another trick that might be used for those who have Excel installed. Create an excel spreadsheet and copy the following structures as much as you want.

array[
array[
...
array[

then from 0 to n, generate numbers in the next column and paste ] character to the adjacent column. So in the end you have

array[ 0 ]
array[ 1 ]
...
array[ n ]

now copy the above 3 columns to a notepad++ file and replace spaces with empty string..

like image 38
polerto Avatar answered Oct 25 '22 00:10

polerto