src/main/java/org/helm/notation2/parser/ConverterHELM1ToHELM2.java
public String doConvert(String str) {

	//check for just missing V2.0
	  
	  ParserHELM2 parser = new ParserHELM2();
	  try{
	  parser.parse(str + "V2.0");
	  return str + "V2.0";
	  }
	  catch(Exception e){
		
    /* Use String Builder */
    /* simple add character -> split works then */
    String helm1 = str + "f";


    StringBuilder helm2 = new StringBuilder();
    String[] sections = helm1.split("}\\$");

    /* Section 1 is accepted in full, no changes necessary, Section 1 has to be there */
    helm2.append(sections[0] + "}$");

    StringBuilder sb = new StringBuilder();
    for (int i = 1; i < sections.length; i++) {
      sb.append(sections[i] + "}$");
    }

    helm1 = "$" + sb.toString();
    sections = helm1.split("\\$");

     /*
     * Section 2 connection section; section 3 is added to the second section,
     * Section 2 is not necessary, is this section really there
     */
     if (sections.length >= 2) {
       if (!(sections[1].isEmpty())) {
        helm2.append(sections[1]);
       }
     }

     /* Add hydrogen bonds to the connection section */
     if (sections.length >= 3) {
       if (!(sections[2].isEmpty())) {
        
         if (!(sections[1].isEmpty())) {
          helm2.append("|" + sections[2]);
         } else {
          helm2.append(sections[2]);
         }
       }
       
       /*Group section*/
      helm2.append("$");

      helm2.append("$");
       
       /*Add annotation to the annotation section*/
       if (sections.length >= 4) {
         if (!(sections[3].isEmpty())) {
          helm2.append(sections[3]);
         }
       }

     }
     
    /* Add version number to indicate HELM2 notation */
    helm2.append("$V2.0");
    return helm2.toString();
	  }
 
  }
public String doConvert(String str) {

	//check for just missing V2.0
	  
	  ParserHELM2 parser = new ParserHELM2();
	  try{
	  parser.parse(str + "V2.0");
	  return str + "V2.0";
	  }
	  catch(Exception e){
		
    /* Use String Builder */
    /* simple add character -> split works then */
    String helm1 = str + "f";


    StringBuilder helm2 = new StringBuilder();
    String[] sections = helm1.split("}\\$");

    /* Section 1 is accepted in full, no changes necessary, Section 1 has to be there */
    helm2.append(sections[0] + "}$");

    StringBuilder sb = new StringBuilder();
    for (int i = 1; i < sections.length; i++) {
      sb.append(sections[i] + "}$");
    }

    helm1 = "$" + sb.toString();
    sections = helm1.split("\\$");

     /*
     * Section 2 connection section; section 3 is added to the second section,
     * Section 2 is not necessary, is this section really there
     */
     if (sections.length >= 2) {
       if (!(sections[1].isEmpty())) {
        helm2.append(sections[1]);
       }
     }

     /* Add hydrogen bonds to the connection section */
     if (sections.length >= 3) {
       if (!(sections[2].isEmpty())) {
        
         if (!(sections[1].isEmpty())) {
          helm2.append("|" + sections[2]);
         } else {
          helm2.append(sections[2]);
         }
       }
       
       /*Group section*/
      helm2.append("$");

      helm2.append("$");
       
       /*Add annotation to the annotation section*/
       if (sections.length >= 4) {
         if (!(sections[3].isEmpty())) {
          helm2.append(sections[3]);
         }
       }

     }
     
    /* Add version number to indicate HELM2 notation */
    helm2.append("$V2.0");
    return helm2.toString();
	  }
 
  }
method to convert the given string into the HELM2 format

@param str HELM1 Notation
@return HELM2 Notation