本文整理汇总了Java中com.helger.commons.string.StringHelper.trim方法的典型用法代码示例。如果您正苦于以下问题:Java StringHelper.trim方法的具体用法?Java StringHelper.trim怎么用?Java StringHelper.trim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.commons.string.StringHelper
的用法示例。
在下文中一共展示了StringHelper.trim方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isRectValue
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Check if the passed value is CSS rectangle definition or not. It checks
* both the current syntax (<code>rect(a,b,c,d)</code>) and the old syntax (
* <code>rect(a b c d)</code>).
*
* @param sCSSValue
* The value to check. May be <code>null</code>.
* @return <code>true</code> if the passed value is a rect value,
* <code>false</code> if not
*/
public static boolean isRectValue (@Nullable final String sCSSValue)
{
final String sRealValue = StringHelper.trim (sCSSValue);
if (StringHelper.hasText (sRealValue))
{
// Current syntax: rect(a,b,c,d)
if (RegExHelper.stringMatchesPattern (PATTERN_CURRENT_SYNTAX, sRealValue))
return true;
// Backward compatible syntax: rect(a b c d)
if (RegExHelper.stringMatchesPattern (PATTERN_OLD_SYNTAX, sRealValue))
return true;
}
return false;
}
示例2: isColorValue
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Check if the passed string is any color value.
*
* @param sValue
* The value to check. May be <code>null</code>.
* @return <code>true</code> if the passed value is not <code>null</code>, not
* empty and a valid CSS color value.
* @see #isRGBColorValue(String)
* @see #isRGBAColorValue(String)
* @see #isHSLColorValue(String)
* @see #isHSLAColorValue(String)
* @see #isHexColorValue(String)
* @see ECSSColor#isDefaultColorName(String)
* @see ECSSColorName#isDefaultColorName(String)
* @see CCSSValue#CURRENTCOLOR
*/
public static boolean isColorValue (@Nullable final String sValue)
{
final String sRealValue = StringHelper.trim (sValue);
if (StringHelper.hasNoText (sRealValue))
return false;
return isRGBColorValue (sRealValue) ||
isRGBAColorValue (sRealValue) ||
isHSLColorValue (sRealValue) ||
isHSLAColorValue (sRealValue) ||
isHexColorValue (sRealValue) ||
ECSSColor.isDefaultColorName (sRealValue) ||
ECSSColorName.isDefaultColorName (sRealValue) ||
sRealValue.equals (CCSSValue.CURRENTCOLOR) ||
sRealValue.equals (CCSSValue.TRANSPARENT);
}
示例3: addIssue
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Add a new issue ID to this entry.
*
* @param sIssue
* The issue ID to be added. If it is <code>null</code> or empty, the
* call is ignored.
* @return {@link EChange}
*/
@Nonnull
public EChange addIssue (@Nullable final String sIssue)
{
final String sRealIssue = StringHelper.trim (sIssue);
if (StringHelper.hasNoText (sRealIssue))
return EChange.UNCHANGED;
m_aIssues.add (sRealIssue);
return EChange.CHANGED;
}
示例4: getCleanedLine
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
@CheckReturnValue
public static String getCleanedLine (@Nullable final String sLine)
{
String ret = StringHelper.trim (sLine);
if (StringHelper.hasText (ret))
{
// Remove the Skype highlighting :)
ret = RegExHelper.stringReplacePattern ("begin_of_the_skype_highlighting.+end_of_the_skype_highlighting",
ret,
"");
}
return ret;
}
示例5: AbstractSVRLMessage
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public AbstractSVRLMessage (@Nullable final List <DiagnosticReference> aDiagnosticReferences,
@Nullable final String sText,
@Nullable final String sLocation,
@Nullable final String sTest,
@Nullable final String sRole,
@Nullable final IErrorLevel aFlag)
{
m_aDiagnosticReferences = new CommonsArrayList <> (aDiagnosticReferences);
m_sText = StringHelper.trim (sText);
m_sLocation = sLocation;
m_sTest = sTest;
m_sRole = sRole;
m_aFlag = aFlag;
}
示例6: isURLValue
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Check if the passed CSS value is an URL value. This is either a URL
* starting with "url(" or it is the string "none".
*
* @param sValue
* The value to be checked.
* @return <code>true</code> if the passed value starts with "url(" and ends
* with ")" - <code>false</code> otherwise.
*/
public static boolean isURLValue (@Nullable final String sValue)
{
final String sRealValue = StringHelper.trim (sValue);
if (StringHelper.hasNoText (sRealValue))
return false;
if (sRealValue.equals (CCSSValue.NONE))
return true;
// 5 = "url(".length () + ")".length
return sRealValue.length () > 5 &&
sRealValue.startsWith (CCSSValue.PREFIX_URL_OPEN) &&
sRealValue.endsWith (CCSSValue.SUFFIX_URL_CLOSE);
}
示例7: getParsedRGBColorValue
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Extract the CSS RGB color value from the passed String. Example value:
* <code>rgb(255,0,0)</code>
*
* @param sValue
* The value to extract the value from. May be <code>null</code>.
* @return <code>null</code> if the passed value is not a valid CSS RGB color
* value.
*/
@Nullable
public static CSSRGB getParsedRGBColorValue (@Nullable final String sValue)
{
final String sRealValue = StringHelper.trim (sValue);
if (StringHelper.hasText (sRealValue) && sRealValue.startsWith (CCSSValue.PREFIX_RGB))
{
final String [] aValues = RegExHelper.getAllMatchingGroupValues (PATTERN_RGB, sRealValue);
if (aValues != null)
return new CSSRGB (aValues[0], aValues[1], aValues[2]);
}
return null;
}
示例8: getParsedRGBAColorValue
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public static CSSRGBA getParsedRGBAColorValue (@Nullable final String sValue)
{
final String sRealValue = StringHelper.trim (sValue);
if (StringHelper.hasText (sRealValue) && sRealValue.startsWith (CCSSValue.PREFIX_RGBA))
{
final String [] aValues = RegExHelper.getAllMatchingGroupValues (PATTERN_RGBA, sRealValue);
if (aValues != null)
return new CSSRGBA (aValues[0], aValues[1], aValues[2], aValues[3]);
}
return null;
}
示例9: getParsedHSLColorValue
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public static CSSHSL getParsedHSLColorValue (@Nullable final String sValue)
{
final String sRealValue = StringHelper.trim (sValue);
if (StringHelper.hasText (sRealValue) && sRealValue.startsWith (CCSSValue.PREFIX_HSL))
{
final String [] aValues = RegExHelper.getAllMatchingGroupValues (PATTERN_HSL, sRealValue);
if (aValues != null)
return new CSSHSL (aValues[0], aValues[1], aValues[2]);
}
return null;
}
示例10: getParsedHSLAColorValue
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public static CSSHSLA getParsedHSLAColorValue (@Nullable final String sValue)
{
final String sRealValue = StringHelper.trim (sValue);
if (StringHelper.hasText (sRealValue) && sRealValue.startsWith (CCSSValue.PREFIX_HSLA))
{
final String [] aValues = RegExHelper.getAllMatchingGroupValues (PATTERN_HSLA, sRealValue);
if (aValues != null)
return new CSSHSLA (aValues[0], aValues[1], aValues[2], aValues[3]);
}
return null;
}
示例11: putIn
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Override
@Nonnull
public EChange putIn (@Nonnull @Nonempty final String sFieldName, @Nullable final Object aNewValue)
{
return super.putIn (sFieldName, StringHelper.trim ((String) aNewValue));
}
示例12: setBody
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public CSSUnknownRule setBody (@Nullable final String sBody)
{
m_sBody = StringHelper.trim (sBody);
return this;
}
示例13: setParameterList
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public CSSUnknownRule setParameterList (@Nullable final String sParameterList)
{
m_sParameterList = StringHelper.trim (sParameterList);
return this;
}
示例14: setText
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Set the change text of this entry in the specified locale.
*
* @param aContentLocale
* The locale of the change.
* @param sText
* The text to be set. If the text is <code>null</code> or empty the
* call is ignored.
* @return {@link EChange}
*/
@Nonnull
public EChange setText (@Nonnull final Locale aContentLocale, @Nullable final String sText)
{
final String sRealText = StringHelper.trim (sText);
if (StringHelper.hasNoText (sRealText))
return EChange.UNCHANGED;
return m_aTexts.setText (aContentLocale, sRealText);
}
示例15: isRGBColorValue
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Check if the passed String is valid CSS RGB color value. Example value:
* <code>rgb(255,0,0)</code>
*
* @param sValue
* The value to check. May be <code>null</code>.
* @return <code>true</code> if it is a CSS RGB color value,
* <code>false</code> if not
*/
public static boolean isRGBColorValue (@Nullable final String sValue)
{
final String sRealValue = StringHelper.trim (sValue);
// startsWith as speedup
return StringHelper.hasText (sRealValue) &&
sRealValue.startsWith (CCSSValue.PREFIX_RGB) &&
RegExHelper.stringMatchesPattern (PATTERN_RGB, sRealValue);
}