title: Parsing and replacing doubles in Java String
body: <p>I am writing java code for  translating signals. If a given string (INPUT) is:</p>
  
  <pre><code>C*12.387a0d14assc7*18.65d142a
  </code></pre>
  
  <p>Its translation (OUTPUT) should be: </p>
  
  <pre><code>C*12387:1000a0d14assc7*1865:100d142a 
  </code></pre>
  
  <p>ALGORITHM: </p>
  
  <p>Wherever in the string a star(*) follows a number containing decimal (in this string there are two, first is '*12.387' and the second is *18.65'), this number is to be changed into fraction as in the above example 12.387 is converted into 12387:1000 and 18.65 converted into 1865:100</p>
  
  <p>If decimal number is isolated I can convert it into fraction with the following code:</p>
  
  <pre><code>    double d = 12.387;
      String str = Double.toString(d);        
      String[] fraction = str.split("\\.");
  
      int denominator = (int)Math.pow(10, fraction[1].length());
      int numerator = Integer.parseInt(fraction[0] + "" + fraction[1]);
  
      System.out.println(numerator + ":" + denominator);
  </code></pre>
  
  <p>But I do not how to separate the substring of decimal number from the string it contains. Being new to java and programming I need help. Thanks in anticipation.</p>