将 Netbeans 编辑器中的数字替换为递增数字

发布于 2024-07-19 07:17:58 字数 754 浏览 2 评论 0原文

我在 Netbeans 6.1 编辑器中有一些代码,看起来像这样

fooString(8)
fooString(8)
fooString(8)
fooString(8)
foostring2(8)
foostring3(8)
foostring4(8)
foostring5(8)
foostring6(8)
foostring7(8)
foostring7(9)
foostring7(10)
foostring7(11)
foostring7(12)

我想将其转换为 fooString(1)
fooString(2)
fooString(3)
fooString(4)
foostring2(5)
foostring3(6)
foostring4(7)
foostring5(8)
foostring6(9)
foostring7(10)
foostring7(11)
foostring7(12)
foostring7(13)
foostring7(14)

有没有办法,例如使用正则表达式或其他任何东西来完成这项工作?

谢谢

I have some code in Netbeans 6.1 editor that looks like this

fooString(8)
fooString(8)
fooString(8)
fooString(8)
foostring2(8)
foostring3(8)
foostring4(8)
foostring5(8)
foostring6(8)
foostring7(8)
foostring7(9)
foostring7(10)
foostring7(11)
foostring7(12)

and i want to convert it to
fooString(1)
fooString(2)
fooString(3)
fooString(4)
foostring2(5)
foostring3(6)
foostring4(7)
foostring5(8)
foostring6(9)
foostring7(10)
foostring7(11)
foostring7(12)
foostring7(13)
foostring7(14)

Is there a way e.g with regular expresions or anything else to do the job?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你另情深 2024-07-26 07:17:58

您想以编程方式执行此操作吗? 如果没有,那么我会执行以下操作:

  1. 使用正则表达式在数字周围插入制表符,以便 (8) 变为 (\t8\t)
  2. 将其复制到 Excel 工作表。 该选项卡会将数字排列在单独的列中,即 Excel 看起来像这样。

    <前><代码> ABC
    foostring(8)

    foostring1( 8 )

    foostring2( 8 )

  3. 现在更改 B 列中的值。只需在前 2 行中键入 1 和 2,然后向下拖动以填充行的 rset。

    现在

  4. 复制回 netbeans 编辑器并删除在步骤 1 中插入的选项卡。

Do you want to do this programmatically? If not, then I'd do the following

  1. Use regular expression to insert a tab around the number so (8) becomes (\t8\t)
  2. Copy this to an Excel sheet. The tab would arrange the numbers in a separate column i.e. excel will look something like this.

          A            B        C
       foostring(      8        )
    
       foostring1(     8        )
    
       foostring2(     8        )
    

    etc.

  3. Now change the values in column B. Just type 1 and 2 in the first 2 rows and drag down to fill the rset of rows.

  4. Copy back to netbeans editor and remove the tabs inserted in step 1.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文