public java.lang.String trim(java.lang.String s) { return StringUtil.trim(s); }
public java.lang.String trim(java.lang.String s, char c) { return StringUtil.trim(s, c); }
public java.lang.String trim(java.lang.String s, char[] exceptions) { return StringUtil.trim(s, exceptions); }
/** * Trims leading and trailing whitespace from the string, up to but not * including the whitespace character specified by <code>c</code>. * * <p> * Examples: * </p> * * <p> * <pre> * <code> * trim(" \tHey\t ", '\t') returns "\tHey\t" * trim(" \t Hey \t ", '\t') returns "\t Hey \t" * </code> * </pre></p> * * @param s the original string * @param c the whitespace character to limit trimming * @return a string representing the original string with leading and * trailing whitespace removed, up to but not including the * whitespace character specified by <code>c</code> */ public static String trim(String s, char c) { return trim(s, new char[] {c}); }
public String resolveHttpMethod(Method method) { JSONWebService jsonWebServiceAnnotation = method.getAnnotation( JSONWebService.class); String httpMethod = null; if (jsonWebServiceAnnotation != null) { httpMethod = StringUtil.trim(jsonWebServiceAnnotation.method()); } if ((httpMethod != null) && (httpMethod.length() != 0)) { return httpMethod; } return _jsonWebServiceNaming.convertMethodToHttpMethod(method); }
public static String formatName(String name) { if (Validator.isNull(name)) { return name; } String lowerCaseName = StringUtil.trim(StringUtil.toLowerCase(name)); char[] chars = lowerCaseName.toCharArray(); if (chars.length > 0) { chars[0] = Character.toUpperCase(chars[0]); } for (int i = 0; i < chars.length; i++) { if (chars[i] == ' ') { chars[i + 1] = Character.toUpperCase(chars[i + 1]); } } return new String(chars); }
public void put(String line) { line = line.trim(); if (_isComment(line)) { return; } int pos = line.indexOf(CharPool.EQUAL); if (pos == -1) { _log.error("Invalid property on line " + line); } else { String value = StringUtil.trim(line.substring(pos + 1)); if (_safe) { value = _decode(value); } setProperty(StringUtil.trim(line.substring(0, pos)), value); } }
/** * Returns the request parameter value as a String. If the parameter is * missing or not convertible to a String, the default value is returned. * * @param request the servlet request from which to read the parameter * @param param the name of the parameter * @param defaultValue a default value * @return the request parameter value as a String */ public static String get( HttpServletRequest request, String param, String defaultValue) { String returnValue = GetterUtil.get( request.getParameter(param), defaultValue); if (returnValue != null) { return _normalize(StringUtil.trim(returnValue)); } return null; }
public String resolvePath(Class<?> clazz, Method method) { JSONWebService jsonWebServiceAnnotation = method.getAnnotation( JSONWebService.class); String path = null; if (jsonWebServiceAnnotation != null) { path = StringUtil.trim(jsonWebServiceAnnotation.value()); } if ((path == null) || (path.length() == 0)) { path = _jsonWebServiceNaming.convertMethodToPath(method); } if (path.startsWith(StringPool.SLASH)) { return path; } path = StringPool.SLASH + path; String pathFromClass = null; jsonWebServiceAnnotation = clazz.getAnnotation(JSONWebService.class); if (jsonWebServiceAnnotation != null) { pathFromClass = StringUtil.trim(jsonWebServiceAnnotation.value()); } if ((pathFromClass == null) || (pathFromClass.length() == 0)) { pathFromClass = _jsonWebServiceNaming.convertServiceClassToPath( clazz); } if (!pathFromClass.startsWith(StringPool.SLASH)) { pathFromClass = StringPool.SLASH + pathFromClass; } return pathFromClass + path; }
String trimmedValue = StringUtil.trim(st.sval);
/** * Returns the service context parameter value as a String. If the parameter * is missing or not convertible to a String, the default value is returned. * * @param serviceContext the service context from which to read the * parameter * @param param the name of the parameter * @param defaultValue a default value * @return the service context parameter value as a String */ public static String get( ServiceContext serviceContext, String param, String defaultValue) { String returnValue = GetterUtil.get( serviceContext.getAttribute(param), defaultValue); if (returnValue != null) { return _normalize(StringUtil.trim(returnValue)); } return null; }
/** * Returns the portlet request parameter value as a String. If the parameter * is missing or not convertible to a String, the default value is returned. * * @param portletRequest the portlet request from which to read the * parameter * @param param the name of the parameter * @param defaultValue a default value * @return the portlet request parameter value as a String */ public static String get( PortletRequest portletRequest, String param, String defaultValue) { String returnValue = GetterUtil.get( portletRequest.getParameter(param), defaultValue); if (returnValue != null) { return _normalize(StringUtil.trim(returnValue)); } return null; }
public void append( String content, String modules, ModulesType modulesType) { if (Validator.isNull(modules)) { _rawSB.append(content); } else { String[] modulesArray = StringUtil.split(modules); if (modulesType == ModulesType.AUI) { _auiCallbackSB.append("(function() {"); _auiCallbackSB.append(content); _auiCallbackSB.append("})();"); for (String module : modulesArray) { _auiModulesSet.add(StringUtil.trim(module)); } } else { _es6CallbackSB.append("(function() {"); _es6CallbackSB.append(content); _es6CallbackSB.append("})();"); for (String module : modulesArray) { _es6ModulesSet.add(StringUtil.trim(module)); } } } }
public void append( StringBundler contentSB, String modules, ModulesType modulesType) { if (Validator.isNull(modules)) { _rawSB.append(contentSB); } else { String[] modulesArray = StringUtil.split(modules); if (modulesType == ModulesType.AUI) { _auiCallbackSB.append("(function() {"); _auiCallbackSB.append(contentSB); _auiCallbackSB.append("})();"); for (String module : modulesArray) { _auiModulesSet.add(StringUtil.trim(module)); } } else { _es6CallbackSB.append("(function() {"); _es6CallbackSB.append(contentSB); _es6CallbackSB.append("})();"); for (String module : modulesArray) { _es6ModulesSet.add(StringUtil.trim(module)); } } } }
@Override public String getOrderBy() { String orderBy = _orderByComparator.getOrderBy(); if (_tableName == null) { return orderBy; } String[] columnNames = StringUtil.split(orderBy); StringBundler sb = new StringBundler((3 * columnNames.length) - 1); for (int i = 0; i < columnNames.length; ++i) { String columnName = columnNames[i]; if (columnName.indexOf(CharPool.PERIOD) != -1) { columnName = StringUtil.split(columnName, CharPool.PERIOD)[1]; } sb.append(_tableName); sb.append(StringUtil.trim(columnName)); if (i < (columnNames.length - 1)) { sb.append(StringPool.COMMA_AND_SPACE); } } return sb.toString(); }
return StringUtil.trim(sb.toString());
public static String trim(String s) { return trim(s, null); }
protected String getTemplateContent( Template template, TemplateVariableDefinition templateVariableDefinition, String language) throws Exception { prepareTemplate(template, templateVariableDefinition, language); Writer writer = new UnsyncStringWriter(); template.processTemplate(writer); return StringUtil.trim(writer.toString()); }
public default boolean isEmpty( DDMFormFieldValue ddmFormFieldValue, Locale locale) { Value value = ddmFormFieldValue.getValue(); if (value == null) { return true; } String valueString = StringUtil.trim(value.getString(locale)); return Validator.isNull(valueString); }