开发者

Notepad++ numbering an array

开发者 https://www.devze.com 2023-03-07 12:50 出处:网络
Is that possible to create an ordered list of arrays in N开发者_开发问答otepad++ using the following:

Is that possible to create an ordered list of arrays in N开发者_开发问答otepad++ 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.


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 !!


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..

0

精彩评论

暂无评论...
验证码 换一张
取 消