粘贴到Eclipse中的长字符串是不可见的

时间:2017-01-17 12:25:31

标签: java eclipse

将以下String粘贴到Eclipse中时,文本显示为空格:

1140002,1210002,1960001,2120002,2140001,3890001,6770002,6800002,7790002,9130002,10230002,12110002,12120002,13660002,14130001,14480002,15540001,15990002,16240002,16720002,16840002,16930002,17180002,18750001,19330001,35170001,39220001,41950001,42120001,43080001,54100001,56410001,65970001,82040001,84530001,84710001,84730001,85010001,85250001,85340001,85630001,85730001,85790001,85930001,85970001,86040001,86370001,86490001,86670001,86680001,86830001,86910001,86940001,87120001,90860001,93220001,97730001,98330001,107400001,110800001,118420001,118830001,118970001,121690001,121710001,122980001,125030001,125040001,125670001,125700001,125860001,125880001,128720001,129000001,130720001,131330001,135460001,140770001,141420001,141720001,142690001,145610001,970001,1400001,1530001,1760001,2020001,2270002,2890001,4150001,5780002,8430002,9150001,9970002,11780002,13860002,14160002,14240002,14490001,14500002,14530002,14850002,15290002,15560002,15690002,16300002,16620001,16660001,17200002,19580001,19790001,39760001,42010001,55540001,56640001,56910001,56920001,57230001,57390001,57420001,57600001,57860001,65690001,74550001,77280001,81340001,81880001,82100001,82920001,83200001,84280001,84350001,84790001,84970001,85260001,85380001,85700001,85980001,86050001,86590001,86600001,86660001,87150001,87360001,87550001,93110001,97540001,102430001,111200001,118880001,119020001,119970001,121700001,123780001,124940001,125000001,125450001,125760001,125790001,128690001,129180001,129980001,129990001,130000001,131340001,133430001,135340001,135470001,135480001,137040001,137140001,137490001,138130001,140050001,140800001,141970001,142460001,142860001,146730001,840002,2630001,3420001,5270001,7830002,9640002,9800002,10040002,10190002,12030002,13090001,14090002,15100002,15380002,15390002,15590002,15790002,15920002,16630001,16640002,17170002,17740001,19460001,55570001,57020001,57130001,57620001,57690001,65450001,66300001,68470001,68680001,69250001,70510001,71930001,72060001,75220001,75890001,77810001,81540001,84870001,84880001,85000001,85130001,85270001,85320001,85410001,85510001,85580001,85750001,85770001,86090001,86110001,86290001,86300001,86460001,86510001,86750001,86770001,87060001,87340001,92850001,94320001,96850001,102900001,103390001,108940001,110710001,112550001,113020001,114550001,118380001,124410001,124840001,124850001,125050001,125780001,125870001,125900001,126690001,128750001,129050001,129270001,130170001,130700001,130730001,132470001,132830001,133480001,133570001,134780001,135930001,135990001,136220001,140060001,141150001,141590001,142480001,143090001,148280001,1200002,2300001,3790001,6870002,7840002,8380002,8420002,8890001,9930002,10030001,10870001,12340001,12680002,12920002,13410002,13520002,14070002,14200002,14280002,14360002,14970001,15310002,15700002,15880002,16310002,16380002,16450002,16750002,16780002,16850002,17610001,18560001,19370001,37820001,40370001,54050001,57000001,58020001,68850001,69740001,75290001,78650001,80290001,83690001,84490001,84580001,84600001,84630001,85120001,85180001,85420001,85670001,85780001,85830001,85870001,86080001,86320001,86390001,86400001,86820001,86920001,87040001,87890001,87910001,94400001,94550001,97030001,97170001,99630001,101570001,109360001,110650001,110860001,110880001,114480001,118930001,119010001,124500001,124520001,125010001,125320001,125340001,125530001,125690001,130760001,131360001,131370001,132910001,133100001,133410001,133530001,133660001,136080001,137070001,141410001,141690001,142470001,142840001,144240001,146680001,147720001,930001,1780001,2520001,5320001,6050002,7970002,8360002,10770002,11360002,13000002,13690002,14270002,14290002,15470002,15520001,15520002,15550002,15670001,15910002,16190002,16610001,16680001,16790002,16860002,16890001,19150001,31990001,35990001,36360001,40790001,41290001,41930001,56460001,56930001,57180001,57190001,65400001,68670001,75340001,76010001,77110001,77460001,83750001,84640001,84840001,86240001,86410001,86430001,86470001,86730001,86790001,86810001,86970001,89300001,93130001,93700001,94070001,97230001,97270001,98040001,100880001,109440001,109480001,114460001,116050001,116250001,117680001,118410001,122960001,122970001,124090001,125080001,125260001,125330001,125550001,125720001,129660001,131320001,133510001,133580001,136000001,138200001,140790001,141240001,141640001,142020001,142440001,144720001,146000001,990001,2270001,2730001,4090002,6340002,8360001,8390002,10290002,11750002,11970001,12640002,13990002,14040002,14250002,15370002,15500002,15770002,16020002,16370002,16900002,17940001,20610001,38190001,44740001,53780001,56390001,57240001,58000001,68460001,69560001,76640001,79280001,81330001,82960001,84570001,84620001,84720001,84740001,85140001,85240001,85400001,85430001,85470001,85480001,85720001,85920001,85940001,86230001,86880001,87080001,87090001,87330001,93090001,93150001,93160001,93250001,94520001,95080001,97210001,110260001,118540001,121180001,121240001,121490001,123810001,124550001,124890001,124920001,125220001,125380001,125500001,125890001,128990001,129500001,129730001,129970001,130710001,130740001,130750001,133370001,133740001,135160001,135890001,137130001,137620001,138180001,138190001,141390001,141710001,143060001,146670001,147640001,750001,990002,1000002,5090002,6460002,6520002,8030002,8320001,9390001,9520001,10840002,11460002,13060002,14140002,14300002,14350002,14370002,14790002,14840002,14940001,15050002,15630002,15860002,16100002,16630002,16650001,16670001,16670002,16700002,17270002,18530001,18710001,32430001,32730001,33310001,43140001,43150001,54090001,55580001,56230001,57060001,57100001,57340001,57440001,57560001,57750001,58120001,65940001,65990001,68480001,69410001,76560001,82860001,83890001,84610001,84910001,85190001,85200001,85330001,85360001,85490001,85540001,85820001,86060001,86520001,86720001,87350001,87580001,93190001,93480001,93870001,97640001,102490001,113010001,114470001,117430001,118960001,118980001,119000001,123140001,124960001,125060001,125070001,125250001,125310001,125430001,125510001,125680001,125730001,125770001,125910001,128930001,131390001,132020001,133490001,133500001,133550001,133600001,135450001,136020001,138210001,138600001,140740001,141570001,141660001,141670001,142140001,142450001,142620001,142630001,143120001,147730001,148490001,1100002,1900001,3200002,6760002,10050002,13700002,15030002,15780001,16260002,16650002,16950001,20480001,37830001,38640001,42030001,45300001,54040001,57090001,57580001,75450001,76920001,84130001,84220001,84800001,84810001,84850001,84940001,84980001,85070001,85080001,85220001,85310001,85600001,85840001,85890001,85910001,86650001,86860001,86890001,87050001,93070001,93440001,93750001,94250001,94980001,96360001,99620001,101400001,109000001,109340001,112210001,116140001,118990001,122790001,123200001,124390001,124930001,125410001,125540001,125710001,125740001,128610001,128780001,129040001,129320001,131400001,132270001,132940001,133440001,133670001,135440001,135880001,135900001,135980001,137050001,137060001,140170001,140780001,140970001,141380001,142130001,143020001,143210001,145920001,148300001

有趣的是,这只发生在我程序的main方法中,但不是在主类外面粘贴的时候。

为什么在主方法中粘贴这个长字符串变得完全不可见,我怎样才能将这个字符串粘贴到我的程序中?

1 个答案:

答案 0 :(得分:0)

我认为在这样的情况下,只读取包含所需数据的.txt文件然后将其写入字符串会更明智。我只是好奇为什么Eclipse不接受Java程序中的长字符串。无论如何:

        String myCurrentDir = System.getProperty("user.dir");
        String textDir = myCurrentDir + "\\" + MyClass.class.getName().toString() + ".txt";
        // System.out.println(textDir);

        File f = new File(textDir);
        FileInputStream fin = new FileInputStream(f);
        byte[] buffer = new byte[(int) f.length()];
        new DataInputStream(fin).readFully(buffer);
        fin.close();
        String commaString = new String(buffer, "UTF-8");