How can I retrieve in javascript the index of the first character of a string repeatedly in a text?

i must obtain in javascript the first index of the term "Query Response" that appears multiple times in "output_pacs" that is a variable in which is allocated the content, that is a file with multiple rows and columns.

var strutturaIndici=[];
for(var i=0;i< output_pacs.length;i++)
{
    var indice_primo_carattere= output_pacs(i).indexOf("Query Response");
    strutturaIndici.push(indice_primo_carattere);
}

logger.debug('StrutturaIndici:' +strutturaIndici);

The problem is that the term "Query Response" appears to me multiple times in this file, and i must obtain the first index of this term every time that it appears in this content
with this code, in the console, i don’t obtain the indexes, what can i do?
in the console i obtain this:

[2021-01-30 12:53:20,002]  DEBUG  (js-connector:?): StrutturaIndici:

output_pacs variable

[2021-01-29 08:24:40,001]  DEBUG  (js-connector:?): OutputFromPACS: Start Server listening on port 11112
16:20:00,488 INFO   - Start listening on 0.0.0.0/0.0.0.0:11112
16:20:00,526 INFO   - Association(1) initiated Socket[addr=www.dicomserver.co.uk/51.75.171.41,port=11112,localport=47540]
16:20:00,527 INFO   - qrscp(1): A-ASSOCIATE-RQ qrscp << qrscu
16:20:00,550 INFO   - qrscp(1): A-ASSOCIATE-AC qrscu >> qrscp
16:20:00,553 INFO   - Connected to qrscp@www.dicomserver.co.uk:11112 in 0.072 s
16:20:00,586 INFO   - Send Query Request using 1.2.840.10008.5.1.4.1.2.2.1/Study Root Query/Retrieve Information Model - FIND:
(0008,0020) DA #8 [20200423] Study Date
(0008,0030) TM #0 [] Study Time
(0008,0050) SH #0 [] Accession Number
(0008,0052) CS #6 [STUDY] Query/Retrieve Level
(0010,0010) PN #0 [] Patient’s Name
(0010,0020) LO #0 [] Patient ID
(0020,000D) UI #0 [] Study Instance UID
(0020,0010) SH #0 [] Study ID
(0020,1206) IS #0 [] Number of Study Related Series
(0020,1208) IS #0 [] Number of Study Related Instances

16:20:00,589 INFO   - qrscp(1) << 1:C-FIND-RQ[pcid=1, prior=0

    cuid=1.2.840.10008.5.1.4.1.2.2.1/Study Root Query/Retrieve Information Model - FIND

    ts=1.2.840.10008.1.2/Implicit VR Little Endian]
16:20:00,653 INFO   - qrscp(1) >> 1:C-FIND-RSP[pcid=1, status=ff00H

    cuid=1.2.840.10008.5.1.4.1.2.2.1/Study Root Query/Retrieve Information Model - FIND

    ts=1.2.840.10008.1.2/Implicit VR Little Endian]
16:20:00,672 INFO   - qrscp(1) >> 1:C-FIND-RSP[pcid=1, status=ff00H

    cuid=1.2.840.10008.5.1.4.1.2.2.1/Study Root Query/Retrieve Information Model - FIND

    ts=1.2.840.10008.1.2/Implicit VR Little Endian]
16:20:00,672 INFO   - qrscp(1) >> 1:C-FIND-RSP[pcid=1, status=0H

    cuid=1.2.840.10008.5.1.4.1.2.2.1/Study Root Query/Retrieve Information Model - FIND]
16:20:00,673 INFO   - Query Response #1:
(0008,0005) CS #0 [] Specific Character Set
(0008,0020) DA #8 [20200423] Study Date
(0008,0030) TM #14 [145132.000000] Study Time
(0008,0050) SH #2 [0] Accession Number
(0008,0052) CS #6 [STUDY] Query/Retrieve Level
(0008,0054) AE #6 [qrscp] Retrieve AE Title
(0010,0010) PN #54 [1st Cart D Rabbit Subject^1st Cart D Rabbit Subject^^] Patient’s Name
(0010,0020) LO #26 [1st Cart D Rabbit Subject] Patient ID
(0020,000D) UI #40 [2.16.840.1114456.10000001.1.202004231451] Study Instance UID
(0020,0010) SH #8 [unknown] Study ID
(0020,1206) IS #2 [1] Number of Study Related Series
(0020,1208) IS #2 [2] Number of Study Related Instances

16:20:00,673 INFO   - Query Response #2:
(0008,0005) CS #0 [] Specific Character Set
(0008,0020) DA #8 [20200423] Study Date
(0008,0030) TM #14 [203944.000000] Study Time
(0008,0050) SH #4 [132] Accession Number
(0008,0052) CS #6 [STUDY] Query/Retrieve Level
(0008,0054) AE #6 [qrscp] Retrieve AE Title
(0010,0010) PN #14 [Jones^John^^Mr] Patient’s Name
(0010,0020) LO #6 [PAT009] Patient ID
(0020,000D) UI #26 [1.2.826.0.1.3680043.11.112] Study Instance UID
(0020,0010) SH #2 [1] Study ID
(0020,1206) IS #2 [7] Number of Study Related Series
(0020,1208) IS #2 [11] Number of Study Related Instances

16:20:00,673 INFO   - Received 2 matching entries in 0.122 s
16:20:00,673 INFO   - qrscp(1) << A-RELEASE-RQ
16:20:00,693 INFO   - qrscp(1) >> A-RELEASE-RP
16:20:00,694 INFO   - Released connection to qrscp@www.dicomserver.co.uk:11112
16:20:00,694 INFO   - qrscp(1): close Socket[addr=www.dicomserver.co.uk/51.75.171.41,port=11112,localport=47540]
16:20:00,694 INFO   - Stop listening on 0.0.0.0/0.0.0.0:11112

Thanks

98 thoughts on “How can I retrieve in javascript the index of the first character of a string repeatedly in a text?”

  1. My coder is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the costs. But he’s tryiong none the less.
    I’ve been using WordPress on a variety of websites for about
    a year and am concerned about switching to another platform.
    I have heard very good things about blogengine.net. Is there a way I can transfer all my wordpress content into it?

    Any kind of help would be really appreciated! https://tadalafili.com/

    Reply

Leave a Comment