Example usage for org.apache.commons.lang StringUtils remove

List of usage examples for org.apache.commons.lang StringUtils remove

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils remove.

Prototype

public static String remove(String str, char remove) 

Source Link

Document

Removes all occurrences of a character from within the source string.

Usage

From source file:com.google.gdt.eclipse.designer.model.widgets.panels.LayoutPanelInfo.java

/**
 * Converts "setWidgetLeftRight()" into <code>["left", "right"]</code>.
 */// w ww. j  a  v a  2s  .  c  o  m
private static String[] getLocationPropertyTitles(String signature) {
    String name = StringUtils.substringBefore(signature, "(");
    String elementsName = StringUtils.remove(name, "setWidget");
    String[] titles = StringUtils.splitByCharacterTypeCamelCase(elementsName);
    Assert.isTrue(titles.length == 2, signature);
    titles[0] = titles[0].toLowerCase();
    titles[1] = titles[1].toLowerCase();
    return titles;
}

From source file:com.zb.jcseg.core.JcsegTaskConfig.java

/**
 * reset the value of its options from a propertie file . <br />
 * /*from www.j  ava  2 s.c o  m*/
 * @param proFile path of jcseg.properties file. when null is givend, jcseg will look up the default
 * jcseg.properties file. <br />
 * @throws IOException
 */
public void resetFromPropertyFile(String proFile) throws IOException {
    Properties lexPro = new Properties();
    String jarPath = null;
    /* load the mapping from the default property file. */
    if (proFile == null) {
        /**
         * <pre>
         *      0.load the jcseg.properties from the current data.
         *      1.load the jcseg.properties located with the jar file. 
         *      2.load the jcseg.properties from the classpath. 
         *      3.load the jcseg.properties from the user.home.
         * </pre>
         */
        boolean jcseg_properties = false;
        File pro_file = null;
        String fileName = System.getProperty("jcseg.properties.path");
        if (StringUtils.isNotEmpty(fileName)) {
            pro_file = new File(fileName);
            if (pro_file.exists()) {
                lexPro.load(new FileReader(pro_file));
                jcseg_properties = true;
            }
        }

        // File pro_file = stream2file(this.getClass().getResourceAsStream("/data/" + LEX_PROPERTY_FILE));
        // File pro_file = new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().getFile());
        // InputStream in = getClass().getResourceAsStream("/data/" + LEX_PROPERTY_FILE);

        if (!jcseg_properties) {
            lexPro.load(this.getClass().getResourceAsStream("/data/" + LEX_PROPERTY_FILE));
            if (!lexPro.isEmpty()) {
                jcseg_properties = true;
                jarPath = this.getClass().getProtectionDomain().getCodeSource().getLocation().getFile();
                logger.info("resetFromPropertyFile jarPath :" + jarPath);
                // URL jarUrl = new URL(jarPath);
                // JarURLConnection jarCon = (JarURLConnection) jarUrl.openConnection();
                // jarCon.getJarFile();
                jarPath = StringUtils.remove(jarPath, ".jar");
                File workDir = new File(jarPath);
                // File.createTempFile("", "", new File(StringUtils.remove(jarPath, ".jar")));
                workDir.delete();
                workDir.mkdirs();
                if (!workDir.isDirectory()) {
                    logger.info("Mkdirs failed to create " + workDir);
                    throw new IOException("Mkdirs failed to create " + workDir);
                }
                logger.info("resetFromPropertyFile workDir :" + workDir.getPath());
                unJar(new JarFile(jarPath + ".jar"), workDir);
            }
        }
        if (!jcseg_properties) {
            pro_file = new File(JAR_HOME + "/" + LEX_PROPERTY_FILE);
            if (pro_file.exists()) {
                lexPro.load(new FileReader(pro_file));
                jcseg_properties = true;
            }
        }
        if (!jcseg_properties) {
            InputStream is = JcsegDictionaryFactory.class.getResourceAsStream("/" + LEX_PROPERTY_FILE);
            if (is != null) {
                lexPro.load(new BufferedInputStream(is));
                jcseg_properties = true;
            }
        }
        if (!jcseg_properties) {
            pro_file = new File(System.getProperty("user.home") + "/" + LEX_PROPERTY_FILE);
            if (pro_file.exists()) {
                lexPro.load(new FileReader(pro_file));
                jcseg_properties = true;
            }
        }

        /*
         * jcseg properties file loading status report, show the crorrent properties file location information . <br
         * />
         * @date 2014-09-06
         */
        if (!jcseg_properties) {
            String _report = "jcseg properties[jcseg.properties] file loading error: \n";
            _report += "try the follwing ways to solve the problem: \n";
            _report += "1. put jcseg.properties into the classpath.\n";
            _report += "2. put jcseg.properties together with the jcseg-core-{version}.jar file.\n";
            _report += "3. put jcseg.properties in directory " + System.getProperty("user.home") + "\n\n";
            throw new IOException(_report);
        }
    }
    /* load the mapping from the specified property file. */
    else {
        File pro_file = new File(proFile);
        if (!pro_file.exists())
            throw new IOException("property file [" + proFile + "] not found!");
        lexPro.load(new FileReader(pro_file));
    }

    /* about the lexicon */
    // the lexicon path
    logger.info("jcseg.properties :" + lexPro.values());
    lexPath = (StringUtils.isNotEmpty(jarPath) ? jarPath : StringUtils.EMPTY)
            + lexPro.getProperty("lexicon.path");
    logger.info("################ jarPath : " + jarPath);
    logger.info("################ jcseg.properties lexicon.path : " + lexPro.getProperty("lexicon.path"));
    logger.info("################ lexPath : " + lexPath);
    // lexPath = this.getClass().getResource(lexPath).getFile();
    if (lexPath == null) {
        throw new IOException("lexicon.path property not find in jcseg.properties file!!!");
    }
    if (lexPath.indexOf("{jar.dir}") > -1)
        lexPath = lexPath.replace("{jar.dir}", JAR_HOME);
    // System.out.println("path: "+lexPath);

    // the lexicon file prefix and suffix
    if (lexPro.getProperty("lexicon.suffix") != null)
        suffix = lexPro.getProperty("lexicon.suffix");
    if (lexPro.getProperty("lexicon.prefix") != null)
        prefix = lexPro.getProperty("lexicon.prefix");

    // reset all the options
    if (lexPro.getProperty("jcseg.maxlen") != null)
        MAX_LENGTH = Integer.parseInt(lexPro.getProperty("jcseg.maxlen"));
    if (lexPro.getProperty("jcseg.mixcnlen") != null)
        MIX_CN_LENGTH = Integer.parseInt(lexPro.getProperty("jcseg.mixcnlen"));
    if (lexPro.getProperty("jcseg.icnname") != null && lexPro.getProperty("jcseg.icnname").equals("1"))
        I_CN_NAME = true;
    if (lexPro.getProperty("jcseg.cnmaxlnadron") != null)
        MAX_CN_LNADRON = Integer.parseInt(lexPro.getProperty("jcseg.cnmaxlnadron"));
    if (lexPro.getProperty("jcseg.nsthreshold") != null)
        NAME_SINGLE_THRESHOLD = Integer.parseInt(lexPro.getProperty("jcseg.nsthreshold"));
    if (lexPro.getProperty("jcseg.pptmaxlen") != null)
        PPT_MAX_LENGTH = Integer.parseInt(lexPro.getProperty("jcseg.pptmaxlen"));
    if (lexPro.getProperty("jcseg.loadpinyin") != null && lexPro.getProperty("jcseg.loadpinyin").equals("1"))
        LOAD_CJK_PINYIN = true;
    if (lexPro.getProperty("jcseg.loadsyn") != null && lexPro.getProperty("jcseg.loadsyn").equals("1"))
        LOAD_CJK_SYN = true;
    if (lexPro.getProperty("jcseg.loadpos") != null && lexPro.getProperty("jcseg.loadpos").equals("1"))
        LOAD_CJK_POS = true;
    if (lexPro.getProperty("jcseg.clearstopword") != null
            && lexPro.getProperty("jcseg.clearstopword").equals("1"))
        CLEAR_STOPWORD = true;
    if (lexPro.getProperty("jcseg.cnnumtoarabic") != null
            && lexPro.getProperty("jcseg.cnnumtoarabic").equals("0"))
        CNNUM_TO_ARABIC = false;
    if (lexPro.getProperty("jcseg.cnfratoarabic") != null
            && lexPro.getProperty("jcseg.cnfratoarabic").equals("0"))
        CNFRA_TO_ARABIC = false;
    if (lexPro.getProperty("jcseg.keepunregword") != null
            && lexPro.getProperty("jcseg.keepunregword").equals("1"))
        KEEP_UNREG_WORDS = true;
    if (lexPro.getProperty("lexicon.autoload") != null && lexPro.getProperty("lexicon.autoload").equals("1"))
        lexAutoload = true;
    if (lexPro.getProperty("lexicon.polltime") != null)
        polltime = Integer.parseInt(lexPro.getProperty("lexicon.polltime"));
    if (lexPro.getProperty("wiselyUnionWord") != null && lexPro.getProperty("wiselyUnionWord").equals("1"))
        wiselyUnionWord = true;

    // secondary split
    if (lexPro.getProperty("jcseg.ensencondseg") != null
            && lexPro.getProperty("jcseg.ensencondseg").equals("0"))
        EN_SECOND_SEG = false;
    if (lexPro.getProperty("jcseg.stokenminlen") != null)
        STOKEN_MIN_LEN = Integer.parseInt(lexPro.getProperty("jcseg.stokenminlen"));

    // load the keep punctuations.
    if (lexPro.getProperty("jcseg.keeppunctuations") != null)
        KEEP_PUNCTUATIONS = lexPro.getProperty("jcseg.keeppunctuations");
}

From source file:com.epam.trade.storefront.controllers.misc.StoreSessionController.java

protected String getReturnRedirectUrlForUrlEncoding(final HttpServletRequest request, final String old,
        final String current) {
    final String originalReferer = (String) request.getAttribute(StorefrontFilter.ORIGINAL_REFERER);
    if (StringUtils.isNotBlank(originalReferer)) {
        return REDIRECT_PREFIX + StringUtils.replace(originalReferer, "/" + old + "/", "/" + current + "/");
    }/*from w w  w  .  ja v a2  s .  c o m*/

    String referer = StringUtils.remove(request.getRequestURL().toString(), request.getServletPath());
    if (!StringUtils.endsWith(referer, "/")) {
        referer = referer + "/";
    }
    if (referer != null && !referer.isEmpty() && StringUtils.contains(referer, "/" + old + "/")) {
        return REDIRECT_PREFIX + StringUtils.replace(referer, "/" + old + "/", "/" + current + "/");
    }
    return REDIRECT_PREFIX + referer;
}

From source file:edu.ku.brc.specify.plugins.CollectionRelPlugin.java

/**
 * @return//from  w  w  w .  j  av  a 2s  .c  o m
 */
protected static ViewBasedSearchQueryBuilderIFace createSearchQueryBuilder(final boolean isLeftSide,
        final Collection leftSideCol, final Collection rightSideCol) {
    return new ViewBasedSearchQueryBuilderIFace() {
        /* (non-Javadoc)
         * @see edu.ku.brc.af.ui.db.ViewBasedSearchQueryBuilderIFace#buildSQL(java.lang.String, boolean)
         */
        @Override
        public String buildSQL(String searchText, boolean isForCount) {
            Collection collection = !isLeftSide ? leftSideCol : rightSideCol;
            String cols = isForCount ? "COUNT(*)" : CATNUM_NAME + ", collectionObjectId";
            String sql = String.format(
                    "SELECT %s FROM CollectionObject WHERE collectionMemberId = %d AND %s LIKE '%c%s%c' ORDER BY catalogNumber",
                    cols, collection.getId(), CATNUM_NAME, '%', searchText, '%');
            //System.out.println(sql);
            return sql;
        }

        /* (non-Javadoc)
         * @see edu.ku.brc.af.ui.db.ViewBasedSearchQueryBuilderIFace#buildSQL(java.util.Map, java.util.List)
         */
        @Override
        public String buildSQL(Map<String, Object> dataMap, List<String> fieldNames) {

            Collection collection = !isLeftSide ? leftSideCol : rightSideCol;
            String catNum = (String) dataMap.get("CatalogNumber");
            catNum = StringUtils.remove(catNum, '#');
            String sql = String.format(
                    "SELECT CollectionObjectId, CatalogNumber FROM collectionobject WHERE CollectionMemberID = %d AND CatalogNumber LIKE '%c%s%c' ORDER BY catalogNumber",
                    collection.getId(), '%', catNum, '%');
            //System.out.println(sql);
            return sql;
        }

        /* (non-Javadoc)
         * @see edu.ku.brc.af.ui.db.ViewBasedSearchQueryBuilderIFace#createQueryForIdResults()
         */
        @Override
        public QueryForIdResultsIFace createQueryForIdResults() {
            ExpressResultsTableInfo esTblInfo = ExpressSearchConfigCache
                    .getTableInfoByName("CollectionObjectSearch");
            return new TableSearchResults(
                    DBTableIdMgr.getInstance().getInfoById(CollectionObject.getClassTableId()),
                    esTblInfo.getCaptionInfo()); //true => is HQL
        }

    };
}

From source file:com.linkedin.pinot.index.writer.FixedByteWidthRowColDataFileWriterTest.java

@Test
public void testSpecialCharsForStringReaderWriter() throws Exception {
    final byte[] bytes1 = new byte[] { -17, -65, -67, -17, -65, -67, 32, 69, 120, 101, 99, 117, 116, 105, 118,
            101 };//from   ww w.  j  a  v a2 s . co  m
    final byte[] bytes2 = new byte[] { -17, -65, -68, 32, 99, 97, 108, 103, 97, 114, 121, 32, 106, 117, 110,
            107, 32, 114, 101, 109, 111, 118, 97, 108 };
    File file = new File("test_single_col_writer.dat");
    file.delete();
    int rows = 100;
    int cols = 1;
    String testString1 = new String(bytes1);
    String testString2 = new String(bytes2);
    System.out.println(Arrays.toString(bytes2));
    int stringColumnMaxLength = Math.max(testString1.getBytes().length, testString2.getBytes().length);
    int[] columnSizes = new int[] { stringColumnMaxLength };
    FixedByteSingleValueMultiColWriter writer = new FixedByteSingleValueMultiColWriter(file, rows, cols,
            columnSizes);
    String[] data = new String[rows];
    for (int i = 0; i < rows; i++) {
        String toPut = (i % 2 == 0) ? testString1 : testString2;
        final int padding = stringColumnMaxLength - toPut.getBytes().length;

        final StringBuilder bld = new StringBuilder();
        bld.append(toPut);
        for (int j = 0; j < padding; j++) {
            bld.append(V1Constants.Str.DEFAULT_STRING_PAD_CHAR);
        }
        data[i] = bld.toString();
        writer.setString(i, 0, data[i]);
    }
    writer.close();
    PinotDataBuffer mmapBuffer = PinotDataBuffer.fromFile(file, ReadMode.mmap, FileChannel.MapMode.READ_ONLY,
            "testing");
    FixedByteSingleValueMultiColReader dataFileReader = new FixedByteSingleValueMultiColReader(mmapBuffer, rows,
            1, new int[] { stringColumnMaxLength });
    for (int i = 0; i < rows; i++) {
        String stringInFile = dataFileReader.getString(i, 0);
        Assert.assertEquals(stringInFile, data[i]);
        Assert.assertEquals(
                StringUtils.remove(stringInFile, String.valueOf(V1Constants.Str.DEFAULT_STRING_PAD_CHAR)),
                StringUtils.remove(data[i], String.valueOf(V1Constants.Str.DEFAULT_STRING_PAD_CHAR)));
    }
    file.delete();
}

From source file:br.mdarte.exemplo.academico.accessControl.LoginController.java

public boolean verificarPermissao(ActionMapping mapping, HttpServletRequest request,
        HttpServletResponse response, HttpServlet servlet) throws Exception {
    java.util.HashMap<String, HashMap<String, Collection<accessControl.Perfil>>> servicos = ServicosSingleton
            .instance().getServicos();/*from w  w w  .java 2 s  .c  om*/
    HashMap<String, Collection<accessControl.Perfil>> mapServicos;
    if (servicos == null) {
        mapServicos = new HashMap<String, Collection<accessControl.Perfil>>();
    } else {
        mapServicos = servicos.get("sistemaacademico");
    }
    Subject subject = (Subject) request.getSession().getAttribute(Constantes.USER_SESSION);
    String nomeServico = StringUtils.remove(request.getServletPath(), ".do");
    Servico servico = new Servico(nomeServico);
    boolean possuiPermissao = accessControl.ControleAcesso.verificaPermissao(subject, mapServicos, servico,
            true);
    if (possuiPermissao) {
        return true;
    } else {
        saveErrorMessage(request, "acesso.negado");
        return false;
    }
}

From source file:net.dahanne.gallery3.client.business.G3Client.java

private HttpEntity requestToResponseEntity(String appendToGalleryUrl, List<NameValuePair> nameValuePairs,
        String requestMethod, File file)
        throws UnsupportedEncodingException, IOException, ClientProtocolException, G3GalleryException {
    HttpClient defaultHttpClient = new DefaultHttpClient();
    HttpRequestBase httpMethod;//  www.  j  a  v a 2s.  co  m
    //are we using rewritten urls ?
    if (this.isUsingRewrittenUrls && appendToGalleryUrl.contains(INDEX_PHP_REST)) {
        appendToGalleryUrl = StringUtils.remove(appendToGalleryUrl, "index.php");
    }

    logger.debug("requestToResponseEntity , url requested : {}", galleryItemUrl + appendToGalleryUrl);
    if (POST.equals(requestMethod)) {
        httpMethod = new HttpPost(galleryItemUrl + appendToGalleryUrl);
        httpMethod.setHeader(X_GALLERY_REQUEST_METHOD, requestMethod);
        if (file != null) {
            MultipartEntity multipartEntity = new MultipartEntity();

            String string = nameValuePairs.toString();
            // dirty fix to remove the enclosing entity{}
            String substring = string.substring(string.indexOf("{"), string.lastIndexOf("}") + 1);

            StringBody contentBody = new StringBody(substring, Charset.forName("UTF-8"));
            multipartEntity.addPart("entity", contentBody);
            FileBody fileBody = new FileBody(file);
            multipartEntity.addPart("file", fileBody);
            ((HttpPost) httpMethod).setEntity(multipartEntity);
        } else {
            ((HttpPost) httpMethod).setEntity(new UrlEncodedFormEntity(nameValuePairs));
        }
    } else if (PUT.equals(requestMethod)) {
        httpMethod = new HttpPost(galleryItemUrl + appendToGalleryUrl);
        httpMethod.setHeader(X_GALLERY_REQUEST_METHOD, requestMethod);
        ((HttpPost) httpMethod).setEntity(new UrlEncodedFormEntity(nameValuePairs));
    } else if (DELETE.equals(requestMethod)) {
        httpMethod = new HttpGet(galleryItemUrl + appendToGalleryUrl);
        httpMethod.setHeader(X_GALLERY_REQUEST_METHOD, requestMethod);
        //this is to avoid the HTTP 414 (length too long) error
        //it should only happen when getting items, index.php/rest/items?urls=
        //      } else if(appendToGalleryUrl.length()>2000) {
        //         String resource = appendToGalleryUrl.substring(0,appendToGalleryUrl.indexOf("?"));
        //         String variable = appendToGalleryUrl.substring(appendToGalleryUrl.indexOf("?")+1,appendToGalleryUrl.indexOf("="));
        //         String value = appendToGalleryUrl.substring(appendToGalleryUrl.indexOf("=")+1);
        //         httpMethod = new HttpPost(galleryItemUrl + resource);
        //         httpMethod.setHeader(X_GALLERY_REQUEST_METHOD, requestMethod);
        //         nameValuePairs.add(new BasicNameValuePair(variable, value));
        //         ((HttpPost) httpMethod).setEntity(new UrlEncodedFormEntity(
        //               nameValuePairs));
    } else {
        httpMethod = new HttpGet(galleryItemUrl + appendToGalleryUrl);
    }
    if (existingApiKey != null) {
        httpMethod.setHeader(X_GALLERY_REQUEST_KEY, existingApiKey);
    }
    //adding the userAgent to the request
    httpMethod.setHeader(USER_AGENT, userAgent);
    HttpResponse response = null;

    String[] patternsArray = new String[3];
    patternsArray[0] = "EEE, dd MMM-yyyy-HH:mm:ss z";
    patternsArray[1] = "EEE, dd MMM yyyy HH:mm:ss z";
    patternsArray[2] = "EEE, dd-MMM-yyyy HH:mm:ss z";
    try {
        // be extremely careful here, android httpclient needs it to be
        // an
        // array of string, not an arraylist
        defaultHttpClient.getParams().setParameter(CookieSpecPNames.DATE_PATTERNS, patternsArray);
        response = defaultHttpClient.execute(httpMethod);
    } catch (ClassCastException e) {
        List<String> patternsList = Arrays.asList(patternsArray);
        defaultHttpClient.getParams().setParameter(CookieSpecPNames.DATE_PATTERNS, patternsList);
        response = defaultHttpClient.execute(httpMethod);
    }

    int responseStatusCode = response.getStatusLine().getStatusCode();
    HttpEntity responseEntity = null;
    if (response.getEntity() != null) {
        responseEntity = response.getEntity();
    }

    switch (responseStatusCode) {
    case HttpURLConnection.HTTP_CREATED:
        break;
    case HttpURLConnection.HTTP_OK:
        break;
    case HttpURLConnection.HTTP_MOVED_TEMP:
        //the gallery is using rewritten urls, let's remember it and re hit the server
        this.isUsingRewrittenUrls = true;
        responseEntity = requestToResponseEntity(appendToGalleryUrl, nameValuePairs, requestMethod, file);
        break;
    case HttpURLConnection.HTTP_BAD_REQUEST:
        throw new G3BadRequestException();
    case HttpURLConnection.HTTP_FORBIDDEN:
        //for some reasons, the gallery may respond with 403 when trying to log in with the wrong url
        if (appendToGalleryUrl.contains(INDEX_PHP_REST)) {
            this.isUsingRewrittenUrls = true;
            responseEntity = requestToResponseEntity(appendToGalleryUrl, nameValuePairs, requestMethod, file);
            break;
        }
        throw new G3ForbiddenException();
    case HttpURLConnection.HTTP_NOT_FOUND:
        throw new G3ItemNotFoundException();
    default:
        throw new G3GalleryException("HTTP code " + responseStatusCode);
    }

    return responseEntity;
}

From source file:hudson.maven.RedeployPublisherTest.java

@Test
public void testTarGzUniqueVersionTrueMaven3() throws Exception {
    MavenModuleSet m3 = j.createMavenProject();
    MavenInstallation mvn = j.configureMaven3();
    m3.setMaven(mvn.getName());/*from www.  j  av  a2s  . c  o  m*/
    File repo = tmp.getRoot();
    // a fake build
    m3.setScm(new SingleFileSCM("pom.xml", getClass().getResource("targz-artifact.pom")));
    m3.getPublishersList().add(new RedeployPublisher("", repo.toURI().toString(), true, false));

    MavenModuleSetBuild b = m3.scheduleBuild2(0).get();
    j.assertBuildStatus(Result.SUCCESS, b);

    assertTrue(MavenUtil.maven3orLater(b.getMavenVersionUsed()));

    File artifactDir = new File(repo, "test/test/0.1-SNAPSHOT/");
    String[] files = artifactDir.list(new FilenameFilter() {

        public boolean accept(File dir, String name) {
            return name.contains("-bin.tar.gz") || name.endsWith(".jar") || name.endsWith("-bin.zip");
        }
    });
    System.out.println("deployed files " + Arrays.asList(files));
    assertFalse("tar.gz doesn't exist",
            new File(repo, "test/test/0.1-SNAPSHOT/test-0.1-SNAPSHOT-bin.tar.gz").exists());
    assertTrue("tar.gz doesn't exist", !files[0].contains("SNAPSHOT"));
    for (String file : files) {
        if (file.endsWith("-bin.tar.gz")) {
            String ver = StringUtils.remove(file, "-bin.tar.gz");
            ver = ver.substring(ver.length() - 1, ver.length());
            assertEquals("-bin.tar.gz not ended with 1 , file " + file, "1", ver);
        }
        if (file.endsWith(".jar")) {
            String ver = StringUtils.remove(file, ".jar");
            ver = ver.substring(ver.length() - 1, ver.length());
            assertEquals(".jar not ended with 1 , file " + file, "1", ver);
        }
        if (file.endsWith("-bin.zip")) {
            String ver = StringUtils.remove(file, "-bin.zip");
            ver = ver.substring(ver.length() - 1, ver.length());
            assertEquals("-bin.zip not ended with 1 , file " + file, "1", ver);
        }
    }
}

From source file:edu.monash.merc.util.DMUtil.java

public static String replaceSpace(String spaceStr) {
    return StringUtils.remove(spaceStr, " ");
}

From source file:com.dream.messaging.engine.csv.CSVDataHandler.java

/**
 * Read string./*  w ww.ja v  a 2  s  .  c o m*/
 * 
 * @param message
 *            the message
 * @param node
 *            the node
 * 
 * @return the string
 */
private String readString(Message message, Node node) {
    String msg = (String) message.getContent();
    int index = msg.indexOf(this.delimeter, this.offset);
    if (index < 0) {
        return null;
    }
    String data = msg.substring(this.offset, index);
    this.offset = index + this.delimeter.length();
    // ???

    String sData = data;
    String clsname = QueryNode.getAttribute(node, ElementAttr.Attr_Class);
    if ((clsname != null) && (clsname.equalsIgnoreCase(ElementClassType.CLASS_DECIMAL)
            || clsname.equalsIgnoreCase(ElementClassType.CLASS_DOUBLE)
            || clsname.equalsIgnoreCase(ElementClassType.CLASS_FLOAT))) {
        sData = StringUtils.remove(sData, ",");
        String format = QueryNode.getAttribute(node, ElementAttr.Attr_Format);
        if (format != null) {
            int idx = format.indexOf('s');
            char sign = 0;
            if (idx >= 0) {
                format = format.substring(0, idx);
                if (sData.startsWith("+") || sData.startsWith("-")) {
                    sign = sData.charAt(0);
                    sData = sData.substring(1);

                } else if (sData.endsWith("+") || sData.endsWith("-")) {
                    sign = sData.charAt(sData.length() - 1);
                    sData = sData.substring(0, sData.length() - 1);
                }
            }
            if (sData.indexOf('.') < 0) {
                idx = format.indexOf('p');
                if (idx >= 0) {
                    format = format.substring(idx + 1);
                    idx = format.indexOf('s');
                    if (idx >= 0) {
                        format = format.substring(0, idx);
                    }
                }
                int factor = Integer.parseInt(format);
                int len = sData.length();
                if (len > factor) {
                    sData = sData.substring(0, len - factor) + "." + sData.substring(len - factor);
                }
            }
            sData = sData + sign;
        }
    }
    return sData;
}