js str.replace的最大期限限制?

时间:2019-03-10 21:53:36

标签: javascript replace str-replace

str.replace上的字词是否有上限

从蛮力来看,似乎是2,720,因为它不再处理我的电子表格中的那一行数据。

在下面的简单Web应用程序中,用B列的输出(关键字)代替了A列的输入(汉字)。有没有更好的方法来制作此Web应用程序? (也许在Python中?)

https://pastebin.com/LE2qAXtL

lines = """TRIAL1
Energy: 54432
Coordinates:
0.7 0.4 0.5
0.3 0.4 0.1
0.3 0.4 0.3
TRIAL2
Energy: 54432
Coordinates:
test1
test2
test3"""

# initialize our control variables
counter = 0
collect = False

for line in lines.splitlines():
    if 'TRIAL2' in line:
        # mark the beginning of the block
        counter = 0
        collect = True
        continue
    if not collect:
        # nothing to do, go to next line
        continue
    else:
        # count the lines
        counter += 1
        if 2 < counter < 6:
            # use the 3rd, 4th and 5th line
            print(line)
        elif counter == 6:
            # stop collection at the 6th line of the block
            collect = False

...

以此类推。

此处仅以2,720项的工作版本提供托管。 (我希望能够包含更多数据)

https://chkey.000webhostapp.com/

0 个答案:

没有答案