java 字符串替换效率



  for (int i = 0; i < length; i++) {
                    List strs = new ArrayList<>();
//                 Object[] objs=trials.get(i);
                    String dnadata = (String) xulieDatas.get(i)[7];
                    if (dnadata.length() > 0) {
                        JLabel jep = new JLabel();
                        jep.setFont(new Font("宋体",0,16));//加粗
                        maxlen = Math.max(dnadata.length() * 6 * 1.5f, maxlen);
                        jep.setPreferredSize(new Dimension((int) (dnadata.length() * 6 * 1.5), height));

                        dnadata=dnadata.replaceAll("A","A");
                        dnadata=dnadata.replaceAll("G","G");
                        dnadata=dnadata.replaceAll("T","T");
                        dnadata=dnadata.replaceAll("C","C");
                        dnadata=dnadata.replaceAll("N","N");


                        jep.setText("" + dnadata + "");
                        jep.setName(xulieDatas.get(i)[2] + "");
                        //-----------------
//                         JTextPane jep = new JTextPane();
//                         jep.setPreferredSize(new Dimension(1250, height));
//                         jep.setContentType("text/html");
//
////                StyledDocument doc = jep.getStyledDocument();
////                SimpleAttributeSet center = new SimpleAttributeSet();
////                StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
////                doc.setParagraphAttributes(0, doc.getLength(), center, false);
//                         jep.setText(sb.toString());
                        jLabels.add(jep);

                    }
                }

你可能感兴趣的:(java)