List of usage examples for org.apache.commons.lang StringUtils trimToEmpty
public static String trimToEmpty(String str)
Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null
.
From source file:com.hangum.tadpole.commons.util.ApplicationArgumentUtils.java
/** * runtime? argument ./*ww w . j a v a 2s .c o m*/ * * @param checkString * @return */ private static boolean checkString(String checkString) { String[] applicationArgs = getArguments(); for (String strArg : applicationArgs) { strArg = StringUtils.trimToEmpty(strArg); if (strArg.equalsIgnoreCase(checkString)) return true; } return false; }
From source file:com.prowidesoftware.swift.model.field.Field31R.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from w w w . j av a 2s .c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); if (StringUtils.isNotEmpty(getComponent2())) { result.append("/").append(StringUtils.trimToEmpty(getComponent2())); } return result.toString(); }
From source file:com.prowidesoftware.swift.model.field.Field42C.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*w ww .j a v a2s .co m*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); appendInLines(result, 2, 4); return result.toString(); }
From source file:com.hangum.tadpole.rdb.core.dialog.dbconnect.composite.IRISLoginComposite.java
@Override public void crateComposite() { GridLayout gridLayout = new GridLayout(1, false); gridLayout.verticalSpacing = 2;// www . j a v a2 s . c o m gridLayout.horizontalSpacing = 2; gridLayout.marginHeight = 2; gridLayout.marginWidth = 0; setLayout(gridLayout); setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite compositeBody = new Composite(this, SWT.NONE); GridLayout gl_compositeBody = new GridLayout(1, false); gl_compositeBody.verticalSpacing = 2; gl_compositeBody.horizontalSpacing = 2; gl_compositeBody.marginHeight = 2; gl_compositeBody.marginWidth = 2; compositeBody.setLayout(gl_compositeBody); compositeBody.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); preDBInfo = new PreConnectionInfoGroup(compositeBody, SWT.NONE, listGroupName); preDBInfo.setText(Messages.MSSQLLoginComposite_preDBInfo_text); preDBInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); Group grpConnectionType = new Group(compositeBody, SWT.NONE); grpConnectionType.setLayout(new GridLayout(5, false)); grpConnectionType.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); grpConnectionType.setText(Messages.MSSQLLoginComposite_grpConnectionType_text); Label lblHost = new Label(grpConnectionType, SWT.NONE); lblHost.setText(Messages.DBLoginDialog_1); textHost = new Text(grpConnectionType, SWT.BORDER); textHost.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblNewLabelPort = new Label(grpConnectionType, SWT.NONE); lblNewLabelPort.setText(Messages.DBLoginDialog_5); textPort = new Text(grpConnectionType, SWT.BORDER); textPort.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Button btnPing = new Button(grpConnectionType, SWT.NONE); btnPing.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String host = StringUtils.trimToEmpty(textHost.getText()); String port = StringUtils.trimToEmpty(textPort.getText()); if ("".equals(host) || "".equals(port)) { //$NON-NLS-1$ //$NON-NLS-2$ MessageDialog.openError(null, Messages.DBLoginDialog_10, Messages.DBLoginDialog_11); return; } try { if (isPing(host, port)) { MessageDialog.openInformation(null, Messages.DBLoginDialog_12, Messages.DBLoginDialog_13); } else { MessageDialog.openError(null, Messages.DBLoginDialog_14, Messages.DBLoginDialog_15); } } catch (NumberFormatException nfe) { MessageDialog.openError(null, Messages.MySQLLoginComposite_3, Messages.MySQLLoginComposite_4); } } }); btnPing.setText(Messages.DBLoginDialog_btnPing_text); //Label lblNewLabelDatabase = new Label(grpConnectionType, SWT.NONE); //lblNewLabelDatabase.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1)); //lblNewLabelDatabase.setText(Messages.DBLoginDialog_4); //textDatabase = new Text(grpConnectionType, SWT.BORDER); //textDatabase.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1)); Label lblUser = new Label(grpConnectionType, SWT.NONE); lblUser.setText(Messages.DBLoginDialog_2); textUser = new Text(grpConnectionType, SWT.BORDER); textUser.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(grpConnectionType, SWT.NONE); Label lblPassword = new Label(grpConnectionType, SWT.NONE); lblPassword.setText(Messages.DBLoginDialog_3); textPassword = new Text(grpConnectionType, SWT.BORDER | SWT.PASSWORD); textPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblJdbcOptions = new Label(grpConnectionType, SWT.NONE); lblJdbcOptions.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblJdbcOptions.setText(Messages.MySQLLoginComposite_lblJdbcOptions_text); textJDBCOptions = new Text(grpConnectionType, SWT.BORDER); textJDBCOptions.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1)); othersConnectionInfo = new OthersConnectionBigDataGroup(this, SWT.NONE, getSelectDB()); othersConnectionInfo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); init(); }
From source file:net.bulletin.pdi.xero.step.XeroGetStep.java
private String createXeroUrl(XeroGetStepMeta meta) throws KettleException { StringBuilder url = new StringBuilder(environmentSubstitute(StringUtils.trimToEmpty(meta.getUrl()))); if (0 == url.length()) { throw new KettleException("the xero url must be supplied"); }/*from w w w. j a va 2 s . co m*/ return Helpers.appendUrlQuery(url, "where", environmentSubstitute(StringUtils.trimToEmpty(meta.getWhere()))) .toString(); }
From source file:com.prowidesoftware.swift.model.field.Field35T.java
/** * Serializes the fields' components into the single string value (SWIFT format) *///from w w w . j ava2s .c o m @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("/"); result.append(StringUtils.trimToEmpty(getComponent2())); result.append(StringUtils.trimToEmpty(getComponent3())); return result.toString(); }
From source file:ml.shifu.shifu.core.binning.EqualPopulationBinning.java
/** * Add the value (in format of text) into histogram with frequency 1. * First of all the input string will be trimmed and check whether it is missing value or not * If it is missing value, the missing value count will +1 * After that, the input string will be parsed into double. If it is not a double, invalid value count will +1 * //from ww w. jav a 2s .co m * @see ml.shifu.shifu.core.binning.AbstractBinning#addData(java.lang.String) */ @Override public void addData(String val) { String fval = StringUtils.trimToEmpty(val); if (!isMissingVal(fval)) { double dval = 0; try { dval = Double.parseDouble(fval); } catch (NumberFormatException e) { // not a number? just ignore super.incInvalidValCnt(); return; } process(dval, 1); } else { super.incMissingValCnt(); } }
From source file:com.edgenius.wiki.service.impl.WidgetServiceImpl.java
public Widget getWidgetByKey(String key) { //if postgreSQL, key is null may cause error - I don't investigate //what exact case will cause widget UUID is null,but happen in my local test //server(running from very old version,so may caused by bug in old version). Anyway, use trimToNull() to avoid this. return widgetDAO.getByUUID(StringUtils.trimToEmpty(key)); }
From source file:com.prowidesoftware.swift.model.field.Field20E.java
/** * Serializes the fields' components into the single string value (SWIFT format) *//*from w w w . j a va2 s.c om*/ @Override public String getValue() { final StringBuilder result = new StringBuilder(); result.append(StringUtils.trimToEmpty(getComponent1())); result.append("//"); result.append(StringUtils.trimToEmpty(getComponent2())); return result.toString(); }
From source file:com.metasoft.claim.service.impl.report.BillingServiceImpl.java
@Override public List<BillingExportResult> searchExport(Integer[] ids) { List<TblClaimRecovery> results = claimDao.findByIds(ids); List<BillingExportResult> vos = new ArrayList<BillingExportResult>(); if (results != null) { int i = 1; for (TblClaimRecovery claim : results) { BillingExportResult export = new BillingExportResult(); export.setNo(i++);//from ww w . ja va 2 s. co m if (claim.getCloseDate() != null) { export.setCloseDate(claim.getCloseDate()); } if (claim.getAccidentDate() != null) { export.setAccidentDate(claim.getAccidentDate()); } export.setJobNo(StringUtils.trimToEmpty(claim.getJobNo())); export.setClaimNumber(StringUtils.trimToEmpty(claim.getClaimNumber())); export.setLicenseNumber(StringUtils.trimToEmpty(claim.getLicenseNumber())); if (claim.getClaimType() != null) { export.setClaimType(claim.getClaimType().getId()); } if (claim.getPartyInsurance() != null) { export.setInsuranceName(claim.getPartyInsurance().getName()); } if (claim.getLicenseNumber() != null) { export.setLicenseNumber(claim.getLicenseNumber()); } if (ClaimType.FAST_TRACK.equals(claim.getClaimType())) { export.setWage(300F); } else if (ClaimType.KFK.equals(claim.getClaimType())) { export.setWage(300F); } else if (ClaimType.REQUEST.equals(claim.getClaimType())) { export.setWage(300F); } else { export.setWage(0F); } export.setClaimAmount(claim.getClaimAmount()); if (claim.getReceiveMoneyType() != null) { export.setReceiveMoneyType(claim.getReceiveMoneyType().getName()); } vos.add(export); } } return vos; }