List of usage examples for org.apache.commons.lang StringUtils trim
public static String trim(String str)
Removes control characters (char <= 32) from both ends of this String, handling null
by returning null
.
From source file:gtu._work.etc.EnglishAdd.java
void scanWord() { String word = StringUtils.defaultString(showwordText.getText()); word = StringUtils.trim(word); if (StringUtils.isBlank(word) || StringUtils.equals(currentWord, word)) { //showChineseLabel.setText(""); return;/* ww w . ja v a 2s.c o m*/ } if (netChkBox.isSelected()) { currentWord = word; WordInfo wordInfo = null; try { wordInfo = diectory.parseToWordInfo(word); } catch (Exception ex) { showChineseArea.setText(word + " ?!!!"); return; } showChineseArea.setText(word + " " + wordInfo.getPronounce() + "\n" + wordInfo.getMeaning()); showwordText.setText(""); } else { showChineseArea.setText(word + "\n" + "=> ?"); showwordText.setText(""); } addWordTable(word); }
From source file:gov.nih.nci.caarray.magetab.idf.IdfDocument.java
private void handleLine(List<String> lineContents, boolean processingTermSources) { if (!isEmpty(lineContents)) { EntryHeading heading = createHeading(lineContents.get(0)); IdfRow idfRow = new IdfRow(heading, IdfRowType.get(heading.getTypeName())); if (ArrayUtils.contains(IdfRowType.TERM_SOURCE_TYPES, idfRow.getType()) != processingTermSources) { return; }//w w w. ja v a2 s .c o m validateColumnValues(idfRow, lineContents); for (int columnIndex = 1; columnIndex < lineContents.size(); columnIndex++) { currentColumnNumber = columnIndex + 1; int valueIndex = columnIndex - 1; String value = StringUtils.trim(lineContents.get(columnIndex)); if (!StringUtils.isEmpty(value)) { value = NCICommonsUtils.performXSSFilter(value, true, true); handleValue(idfRow, value, valueIndex); } } } }
From source file:com.edgenius.wiki.installation.DBLoader.java
public String getDriver(String dbType, String driverType) { driverType = StringUtils.isBlank(driverType) ? "" : ("." + StringUtils.trim(driverType)); return StringUtils.trimToEmpty(prototype.getProperty(dbType + driverType + ".driver")); }
From source file:mitm.djigzo.web.pages.dlp.patterns.PatternsEdit.java
public void onValidateFromName(String name) throws ValidationException, WebServiceCheckedException { if (name != null && !isEditing()) { if (policyPatternManagerWS.getPattern(StringUtils.trim(name)) != null) { throw new ValidationException("A pattern with this name already exists."); }/*from w w w.j a v a 2 s.c o m*/ } }
From source file:com.microsoft.alm.plugin.idea.common.ui.checkout.CheckoutForm.java
public String getParentDirectory() { return StringUtils.trim(parentDirectory.getText()); }
From source file:jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinition.java
/** * Constructor instantiating with parameters in the configuration page. * /* www. ja va 2s.c o m*/ * When instantiating from the saved configuration, * the object is directly serialized with XStream, * and no constructor is used. * * @param name the name of this parameter (used as a variable name). * @param choiceListProvider the choice provider * @param editable whether this parameter can be a value not in choices. * @param description the description of this parameter. Used only for the convenience of users. */ @DataBoundConstructor public ExtensibleChoiceParameterDefinition(String name, ChoiceListProvider choiceListProvider, boolean editable, String description) { // There seems no way to forbid invalid values to be submitted. // SimpleParameterDefinition seems not to trim name parameter, so trim here. super(StringUtils.trim(name), description); this.choiceListProvider = choiceListProvider; this.editable = editable; }
From source file:hydrograph.ui.graph.execution.tracking.utils.TrackingDisplayUtils.java
/** * This function will be return process ID which running on defined port. * //from ww w. ja v a 2s. c o m * @return the service port pid * @throws IOException * Signals that an I/O exception has occurred. */ public String getServicePortPID(Properties properties) throws IOException { int portNumber = Integer.parseInt(properties.getProperty(EXECUTION_TRACKING_PORT)); if (OSValidator.isWindows()) { ProcessBuilder builder = new ProcessBuilder( new String[] { "cmd", "/c", "netstat -a -o -n |findstr :" + portNumber }); Process process = builder.start(); InputStream inputStream = process.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String str = bufferedReader.readLine(); str = StringUtils.substringAfter(str, "LISTENING"); str = StringUtils.trim(str); return str; } return ""; }
From source file:ch.entwine.weblounge.kernel.publisher.EndpointPublishingService.java
/** * Configures this service using the given configuration properties. * //w w w. j a v a 2 s . c om * @param config * the service configuration * @throws ConfigurationException * if configuration fails */ private synchronized boolean configure(Dictionary<?, ?> config) throws ConfigurationException { boolean changed = false; // context path String updatedRestMountpoint = StringUtils.trim((String) config.get(OPT_PATH)); if (updatedRestMountpoint != null) { if (!updatedRestMountpoint.startsWith("/")) throw new IllegalArgumentException("Context path (" + OPT_PATH + ") must start with a '/'"); changed |= !updatedRestMountpoint.equals(defaultContextPathPrefix); defaultContextPathPrefix = updatedRestMountpoint; } return changed; }
From source file:com.microsoft.alm.plugin.idea.common.ui.checkout.CheckoutForm.java
public String getDirectoryName() { return StringUtils.trim(directoryName.getText()); }
From source file:com.liveramp.hank.coordinator.Hosts.java
public static String joinHostFlags(List<String> flags) { List<String> results = new ArrayList<String>(); for (String flag : flags) { results.add(StringUtils.trim(flag)); }/* w w w .j av a 2s. c o m*/ Collections.sort(results); return StringUtils.join(results.toArray(), ","); }