Remove data with similar file names in the array

Source: Internet
Author: User

Demand:

1. Get all files uploaded by VTA, usually pictures and txt files, PDF files.

2. Get the file teller to VTM end push PDF,VTM client not confirm the PDF file name is not changed before the customer confirmed that the file name becomes _signature.pdf, when the customer confirmed the PDF, after the confirmation of the _signature.pdf PDF Overwrite the original PDF without confirmation.

Code:

<!DOCTYPE HTML><HTML><Head>    <MetaCharSet= "Utf-8">    <title></title>    <Scriptsrc= "Jquery.js"CharSet= "Utf-8"></Script>    <Scripttype= "Text/javascript">        $(function() {            $("#btncc"). Click (function() {                varData= [                    "610121_idcheck.jpg",                    "Customer Declaration for VTM a.pdf",                    "Customer Declaration for VTM a_signature.pdf",                    "ebanking.pdf",                    "ebanking_signature.pdf",                    "ebankingggg.pdf",                    "hfe.pdf",                    "Hfesupplementinffffffffffffffffffffffffffdddddddddddddddddddddddddddddddddddddddddddddddddddddffffffffffffffffffffffo Rmation.pdf",                    "hfesupplementinfffffffffffffffffffffffffffffffffffffffffffffffformation.pdf",                    "hfesupplementinformation.pdf",                    "hfesupplementinformation_signature.pdf",                    "hfe_signature.pdf",                    "ebankingggg_signature.pdf"                ]                varHTML=[], arr1=[], arr2=[], ARR3=[], ARR4=[], ARR5=[], LinkArray= []; ARR1=Data.filter (function(item) {returnItem.lastindexof ('. pdf') == -1;                }); ARR2=Data.filter (function(item) {returnItem.lastindexof ('. pdf') != -1 &&Item.lastindexof ('_signature.pdf') == -1;                }); ARR3=Data.filter (function(item) {returnItem.lastindexof ('_signature.pdf') != -1;                }); Arr3.map (function(valsignature) {Arr2.map (function(Valpdf, inx) {if(Valsignature.substring (0, Valsignature.length-  -) ==valpdf.substring (0, Valpdf.length- 4) {arr2.splice (Inx,1);                }                    });                }); ARR4=Arr1.concat (ARR2); ARR5=Arr4.concat (ARR3); Arr5.map (function(Val, inx) {Html.push ("<tr><td><a class= ' file-link file-visited ' href= ' xxxx ' title= '" +Val+ "' target= ' _blank ' >" +Val+ "</a></td></tr>");                }); $("#check-list-table"). Empty (). Append (Html.join ());        });    }); </Script></Head><Body>    <Buttontype= "button"name= "button"ID= "BTNCC">Dot me.</Button>    <Divclass= "Dialog-content">        <TableID= "Check-list-table">        </Table>    </Div></Body></HTML>

Remove data with similar file names in the array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.