package com.andela.currencycalculator.model.helper;

/**
 * Created by Spykins on 22/02/2016.
 */
public class StringManipulator {
    public static String clearApostrophe(String line){
        return line.trim().replace("\"", "");
    }
    public static String replaceSpaceToLower(String line){
        return line.replace(" ", "").toLowerCase();

    }

    public static  String removeLastComma(String line){
        String cleanDouble = StringManipulator.clearApostrophe(line);
        return cleanDouble.substring(0,cleanDouble.length()-1);
    }
}

@@ -46,16 +46,123 @@
 elper;%0A%0A
+import com.andela.currencycalculator.calculatorbrain.CalculatorConstant;%0A%0Aimport java.text.DecimalFormat;%0A%0A
 /**%0A * C
@@ -276,32 +276,33 @@
 phe(String line)
+ 
 %7B%0A        return
@@ -339,16 +339,17 @@
 ;%0A    %7D%0A
+%0A
     publ
@@ -389,32 +389,33 @@
 wer(String line)
+ 
 %7B%0A        return
@@ -478,17 +478,16 @@
  static 
- 
 String r
@@ -513,16 +513,17 @@
 ng line)
+ 
 %7B%0A      
@@ -625,16 +625,17 @@
 tring(0,
+ 
 cleanDou
@@ -650,9 +650,11 @@
 th()
--
+ - 
 1);%0A
@@ -659,10 +659,1162 @@
 ;%0A    %7D%0A
+%0A    public static String formatToTwoDecimalPlaces(double answer) %7B%0A        DecimalFormat decimalFormat = new DecimalFormat(%22.##%22);%0A        String answerString = String.valueOf(answer);%0A%0A        if (answerString.contains(%22-%22)) %7B%0A            return answerString;%0A        %7D%0A        if (answer %25 1 == 0) %7B%0A            if (answerString.contains(%22.%22)) %7B%0A                return answerString.substring(0, answerString.indexOf(%22.%22));%0A            %7D%0A%0A        %7D%0A        if (answer == 0) %7B%0A            return %220%22;%0A        %7D else if (answer %3C 1) %7B%0A            return 0 + String.valueOf(decimalFormat.format(answer));%0A        %7D%0A        return String.valueOf(decimalFormat.format(answer));%0A    %7D%0A%0A    public static boolean isOperator(String lastInputValue) %7B%0A        //String lastInputValue = currencyInput.get(currencyInput.size()-1);%0A        boolean flag = lastInputValue.equals(CalculatorConstant.CALC_ADDITION) %7C%7C%0A                lastInputValue.equals(CalculatorConstant.CALC_SUBTRACT) %7C%7C%0A                lastInputValue.equals(CalculatorConstant.CALC_MULTIPLY)%0A                %7C%7C lastInputValue.equals(CalculatorConstant.CALC_DIVIDE);%0A        return flag;%0A    %7D%0A%0A
 %7D%0A

Refactor String function to StringManipulator class for easy access