How to duplicate code



  • How I can select a code and duplicate it.
    like, is there an option will give me to choose:
    How many times I want this code to duplicate?
    Which words will do ascending order?

    like in below you can see my example code
    I want to copy/duplicate the child like 250 times

            <div id="child-one">
                <div .....................div>
                <div .....................div>
                <div .....................div>
                <div .....................div>
                <div .....................div>
            </div>
    

    also I want the child-[XX] numbers to be in order of ascending
    like in excel, want child numbers to be,
    child-three, child-four, child-five, child-six, child-seven, child-eight, child-nine, and so on…

    EX:

        <div id="parent" .....................>
            <div id="child-one">
                <div .....................div>
                <div .....................div>
                <div .....................div>
                <div .....................div>
                <div .....................div>
            </div>
            <div id="child-two">
                <div .....................div>
                <div .....................div>
                <div .....................div>
                <div .....................div>
                <div .....................div>
            </div>
    		
        </div>
    

    Please when try to help, try to follow up with me, I really need it for project.



  • @Coin-Miner said in How to duplicate code:

    I really need it for project

    Have you even considered the steps to take as it appears you want someone else to do all the hard work and you take the credit.

    If it were me doing this and it was a one off I would do

    1. Generate 1 child record as a template possibly as child-@@
    2. Select that, copy and then paste 4 times below the original.
    3. Select all again and copy, then paste 4 more times below.
    4. Repeat a third time pasting 9 more times. That gives 5 × 5 × 10 = 250.
    5. Place cursor in first position jn file and use column editor to insert ascending numbers, with a repeat such that each new number (not the repeated number) appears on the same line as child-@@.
    6. In a separate tab create a number list with each number on a separate line, then copy that list to here. This website changes the numbers to their word equivalent. Copy the results back.
    7. Use a regular expression to insert the word numbers in the right spot.
    8. Final clean up to include additional html code and remove anything not required.

    Good luck.

    Terry



  • @Terry-R said in How to duplicate code:
    Thank you for answering me!

    Select that, copy and then paste 4 times below the original.
    Select all again and copy, then paste 4 more times below.
    Repeat a third time pasting 9 more times. That gives 5 × 5 × 10 = 250

    I know that “old school” method, but I was wondering if there are a good method to do it, because next project maybe i wanna duplicate it 300, 3rd project maybe need 800, and so on. is there any easy way to do that?

    Place cursor in first position jn file and use column editor to insert ascending numbers, with a repeat such that each new number (not the repeated number) appears on the same line as child-@@.

    I don’t get it, can you take me as new student and explain to me easy way. if that is the easiest way, then thanks I’ll try to ask more and find it out.

    In a separate tab create a number list with each number on a separate line, then copy that list to here. This website changes the numbers to their word equivalent. Copy the results back.
    Use a regular expression to insert the word numbers in the right spot.
    Final clean up to include additional html code and remove anything not required.

    COOL, thanks.



  • @Coin-Miner said in How to duplicate code:

    but I was wondering if there are a good method to do it, because next project maybe i wanna duplicate it 300, 3rd project maybe need 800, and so on. is there any easy way to do that?

    Well I think the question is, are you hired in a job to create html code (many projects) or just trying to pressure someone into creating something to make it easy for you. If in a job to design websites surely you will know the best way, and it likely uses some other application that better meets your needs. If just applying pressure to get someone to do the hard work for you, good luck.

    I stick to my original concept. There are some other options such as creating a program using say PythonScript which integrates into Notepad++ (NPP), but that would require knowledge to program.

    The copy paste idea could be made into a macro which is then run the number of times required.

    As for column editor, it appears you don’t know that function in NPP. Create an empty file/tab in NPP and create at least 11 empty lines. Position the cursor in the very first position, on the first line. Select column editor in the menu, you will be using the insert number. You will see some options such as start number, repeat, leading zero and others. Have a play and see the results.

    As your project wants the numbers as words I looked online and found that linked site within a few seconds. NPP doesn’t handle numbers like that so it’s necessary to get that info elsewhere, then paste it back into NPP so it can use the words.

    I don’t there is anymore to add to help you.

    Good luck
    Tery



  • Well I think the question is, are you hired in a job to create html code (many projects) or just trying to pressure someone into creating something to make it easy for you.

    Terry…! whats wrong with you? no one hired me, I don’t want to hire anyone, I’s just a normal guy wanna do my NFT art with html code. can you please leave the side talks away from here.

    There are some other options such as creating a program using say PythonScript which integrates into Notepad++ (NPP)

    Thats hard for me. I dont wanna go deep in languages of coding :)

    The copy paste idea could be made into a macro which is then run the number of times required.

    Yes I found that yesterday and I found Cnrt + End = will take me to end of the file.

    As for column editor, it appears you don’t know that function in NPP. Create an empty file/tab in NPP and create at least 11 empty lines. Position the cursor in the very first position, on the first line. Select column editor in the menu, you will be using the insert number. You will see some options such as start number, repeat, leading zero and others. Have a play and see the results.

    I got brain fart yesterday because of this, can you please send me any youtube video? I’m sure there are, but I dont know what to search about, I dont have Keywords.

    As your project wants the numbers as words I looked online and found that linked site within a few seconds. NPP doesn’t handle numbers like that so it’s necessary to get that info elsewhere, then paste it back into NPP so it can use the words.

    I can switch that on excel, excel will help me to do this step.


Log in to reply