当前位置: 首页>>代码示例>>Java>>正文


Java StringHelper.startsWith方法代码示例

本文整理汇总了Java中com.helger.commons.string.StringHelper.startsWith方法的典型用法代码示例。如果您正苦于以下问题:Java StringHelper.startsWith方法的具体用法?Java StringHelper.startsWith怎么用?Java StringHelper.startsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.helger.commons.string.StringHelper的用法示例。


在下文中一共展示了StringHelper.startsWith方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCleanConcatenatedUrlPath

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * Concatenate a base URL and a sub path incl. the path cleansing. More or
 * less the same as calling <code>getCleanPath (sURL + "/" + sPath)</code>
 *
 * @param sURL
 *        The base URL. May not be <code>null</code>.
 * @param sPath
 *        The path to append. May not be <code>null</code>.
 * @return The combined, cleaned path.
 * @see #getCleanPath(String)
 */
@Nonnull
public static String getCleanConcatenatedUrlPath (@Nonnull final String sURL, @Nonnull final String sPath)
{
  ValueEnforcer.notNull (sURL, "URL");
  ValueEnforcer.notNull (sPath, "Path");

  // If nothing is to be appended, just clean the base URL
  if (StringHelper.hasNoText (sPath))
    return getCleanPath (sURL);

  final String sRealURL = StringHelper.endsWith (sURL, UNIX_SEPARATOR) ? sURL : sURL + UNIX_SEPARATOR;
  final String sRealPath = StringHelper.startsWith (sPath, UNIX_SEPARATOR) ? sPath.substring (1) : sPath;
  return getCleanPath (sRealURL + sRealPath);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:26,代码来源:FilenameHelper.java

示例2: isExplicitJarFileResource

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public static boolean isExplicitJarFileResource (@Nullable final String sName)
{
  // jar:file - regular JDK
  // wsjar:file - Websphere
  return StringHelper.startsWith (sName, "jar:file:") ||
         StringHelper.startsWith (sName, "wsjar:file:") ||
         StringHelper.startsWith (sName, "zip:file:");
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:DefaultResourceResolver.java

示例3: getTelephoneString

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
@CheckReturnValue
public static String getTelephoneString (@Nullable final ITelephoneNumber aTelNo)
{
  if (aTelNo == null)
    return null;

  final StringBuilder ret = new StringBuilder ();
  // Country and area code
  if (StringHelper.hasText (aTelNo.getCountryCode ()) && StringHelper.hasText (aTelNo.getAreaCode ()))
  {
    // prepend "+" if necessary
    if (!StringHelper.startsWith (aTelNo.getCountryCode (), '+'))
      ret.append ('+');
    ret.append (aTelNo.getCountryCode ()).append ('/');

    // area code
    if (StringHelper.startsWith (aTelNo.getAreaCode (), '0'))
      ret.append (aTelNo.getAreaCode ().substring (1));
    else
      ret.append (aTelNo.getAreaCode ());
  }
  else
    if (aTelNo.getAreaCode () != null)
      ret.append (aTelNo.getAreaCode ());

  if (ret.length () > 0)
    ret.append ('/');

  // main line
  if (aTelNo.getLine () != null)
    ret.append (aTelNo.getLine ());

  // direct dial
  if (StringHelper.hasText (aTelNo.getDirectDial ()))
    ret.append ('-').append (aTelNo.getDirectDial ());
  return ret.toString ();
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:39,代码来源:TelephoneHelper.java

示例4: isValidDeclaration

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public static boolean isValidDeclaration (@Nonnull @Nonempty final String sDeclaration)
{
  return StringHelper.startsWith (sDeclaration, '@') && StringHelper.endsWithIgnoreCase (sDeclaration, "viewport");
}
 
开发者ID:phax,项目名称:ph-css,代码行数:5,代码来源:CSSViewportRule.java

示例5: isValidDeclaration

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public static boolean isValidDeclaration (@Nonnull @Nonempty final String sDeclaration)
{
  return StringHelper.startsWith (sDeclaration, '@') && StringHelper.endsWithIgnoreCase (sDeclaration, "font-face");
}
 
开发者ID:phax,项目名称:ph-css,代码行数:5,代码来源:CSSFontFaceRule.java

示例6: isValidDeclaration

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public static boolean isValidDeclaration (@Nonnull @Nonempty final String sDeclaration)
{
  return StringHelper.startsWith (sDeclaration, '@') && StringHelper.endsWithIgnoreCase (sDeclaration, "keyframes");
}
 
开发者ID:phax,项目名称:ph-css,代码行数:5,代码来源:CSSKeyframesRule.java

示例7: isValidDeclaration

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public static boolean isValidDeclaration (@Nonnull @Nonempty final String sDeclaration)
{
  return StringHelper.startsWith (sDeclaration, '@');
}
 
开发者ID:phax,项目名称:ph-css,代码行数:5,代码来源:CSSUnknownRule.java

示例8: getWithoutClassPathPrefix

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * Remove any leading explicit classpath resource prefixes.
 *
 * @param sPath
 *        The source path to strip the class path prefixes from. May be
 *        <code>null</code>.
 * @return <code>null</code> if the parameter was <code>null</code>.
 * @see #CLASSPATH_PREFIX_LONG
 * @see #CLASSPATH_PREFIX_SHORT
 */
@Nullable
public static String getWithoutClassPathPrefix (@Nullable final String sPath)
{
  if (StringHelper.startsWith (sPath, CLASSPATH_PREFIX_LONG))
    return sPath.substring (CLASSPATH_PREFIX_LONG.length ());
  if (StringHelper.startsWith (sPath, CLASSPATH_PREFIX_SHORT))
    return sPath.substring (CLASSPATH_PREFIX_SHORT.length ());
  return sPath;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:20,代码来源:ClassPathResource.java

示例9: isInternalAttribute

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * Check if the passed attribute name is an internal attribute.
 *
 * @param sAttributeName
 *        The name of the attribute to check. May be <code>null</code>.
 * @return <code>true</code> if the passed attribute name is not
 *         <code>null</code> and starts with the
 *         {@link #SCOPE_ATTRIBUTE_PREFIX_INTERNAL} prefix.
 */
public static boolean isInternalAttribute (@Nullable final String sAttributeName)
{
  return StringHelper.startsWith (sAttributeName, SCOPE_ATTRIBUTE_PREFIX_INTERNAL);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:14,代码来源:ScopeManager.java

示例10: isExplicitClassPathResource

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * Check if the passed resource name is an explicit classpath resource. This
 * is the case, if the name starts either with {@link #CLASSPATH_PREFIX_LONG}
 * or {@link #CLASSPATH_PREFIX_SHORT}.
 *
 * @param sName
 *        The name to check. May be <code>null</code>.
 * @return <code>true</code> if the passed name is not <code>null</code> and
 *         an explicit classpath resource.
 */
public static boolean isExplicitClassPathResource (@Nullable final String sName)
{
  return StringHelper.startsWith (sName, CLASSPATH_PREFIX_LONG) ||
         StringHelper.startsWith (sName, CLASSPATH_PREFIX_SHORT);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:16,代码来源:ClassPathResource.java


注:本文中的com.helger.commons.string.StringHelper.startsWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。