/*************************************************** * * cismet GmbH, Saarbruecken, Germany * * ... and it just works. * ****************************************************/ package de.cismet.cismap.commons.demo; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * DOCUMENT ME! * * @author thorsten.hell@cismet.de * @version $Revision$, $Date$ */ public class NewJFrame extends javax.swing.JFrame { //~ Instance fields -------------------------------------------------------- // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; // End of variables declaration//GEN-END:variables //~ Constructors ----------------------------------------------------------- /** * Creates new form NewJFrame. */ public NewJFrame() { initComponents(); } //~ Methods ---------------------------------------------------------------- /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The * content of this method is always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null); jLabel1.setText(org.openide.util.NbBundle.getMessage(NewJFrame.class, "NewJFrame.jLabel1.text")); // NOI18N getContentPane().add(jLabel1); jLabel1.setBounds(120, 120, 45, 17); pack(); } // </editor-fold>//GEN-END:initComponents /** * DOCUMENT ME! * * @param args the command line arguments */ public static void main(final String[] args) { // java.awt.EventQueue.invokeLater(new Runnable() { // public void run() { // new NewJFrame().setVisible(true); // } // }); String valueString = " 23"; // NOI18N int i = -1; valueString = valueString.trim(); boolean hatAlphaTeil = false; try { for (i = 1; i < valueString.length(); ++i) { System.out.println(i + " " + valueString.substring(0, i)); // NOI18N final Integer integer = new Integer(valueString.substring(0, i)); } } catch (Exception e) { hatAlphaTeil = true; } if (hatAlphaTeil) { System.out.println(i + " " + valueString.substring(0, i)); // NOI18N final String intString = valueString.substring(0, i - 1); final String alphaRest = valueString.substring(i - 1, valueString.length()); System.out.println("intString." + intString.trim() + "."); // NOI18N System.out.println("alphaRest." + alphaRest.trim() + "."); // NOI18N } } }