Java String Distance Sqr(String[] X)

Here you can find the source of Sqr(String[] X)

Description

Sqr

License

Apache License

Declaration

static public String Sqr(String[] X) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    static public String Sqr(String[] X) {
        String[] newstring = new String[X.length];
        String pop = "";
        int i;// w  w  w .j  a  v  a 2 s . co  m
        int M = 0;

        for (i = 0; i < X.length; i++) {
            if (X[i].startsWith("S")) {
                String XXX = X[i].substring(1, X[i].length());
                double result;
                double a = Double.parseDouble(XXX);
                result = Math.sqrt(a);
                newstring[M] = Double.toString(result);
                M++;
            } else {
                newstring[M] = X[i];
                M++;
            }
        }

        for (int ii = 0; ii < newstring.length; ii++) {
            if (newstring[ii] != null)
                pop += newstring[ii];
        }

        return pop;
    }
}

Related

  1. editDistance(String s0, String s1)
  2. EditDistance(String s1, String s2)
  3. editDistance(String str1, String str2)
  4. editDistance(String string1, String string2)
  5. editDistance(String word1, String word2)