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


Java StringHelper.replaceMultiple方法代码示例

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


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

示例1: getWithParamTextsReplacedStatic

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public static String getWithParamTextsReplacedStatic (@Nullable final String sText,
                                                      @Nullable final Map <String, String> aStringReplacements)
{
  if (sText == null)
    return null;
  if (sText.indexOf (PARAM_VARIABLE_PREFIX) < 0)
  {
    // No replacement necessary
    return sText;
  }
  final String ret = StringHelper.replaceMultiple (sText, aStringReplacements);
  if (false && ret.indexOf (PARAM_VARIABLE_PREFIX) >= 0)
    s_aLogger.warn ("Text still contains variables after replacement: " + ret);
  return ret;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:17,代码来源:PSXPathQueryBinding.java

示例2: beforeRender

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Override
@Nonnull
public EChange beforeRender (@Nonnull final PagePreRenderContext aCtx) throws IOException
{
  if (m_bReplacePlaceholder)
  {
    final String sOrigText = m_sOriginalText;
    final String sDisplayText = StringHelper.replaceMultiple (sOrigText, aCtx.getAllPlaceholders ());
    if (!sOrigText.equals (sDisplayText))
    {
      // Something changed
      _setDisplayTextAfterPrepare (sDisplayText, getPrepareAvailableSize ().getWidth ());
      return EChange.CHANGED;
    }
  }
  return EChange.UNCHANGED;
}
 
开发者ID:phax,项目名称:ph-pdf-layout,代码行数:18,代码来源:AbstractPLText.java

示例3: getCleanURLPartWithoutUmlauts

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * Clean an URL part from nasty Umlauts. This mapping needs extension!
 *
 * @param sURLPart
 *        The original URL part. May be <code>null</code>.
 * @return The cleaned version or <code>null</code> if the input was
 *         <code>null</code>.
 */
@Nullable
public static String getCleanURLPartWithoutUmlauts (@Nullable final String sURLPart)
{
  if (s_aCleanURLOld == null)
    _initCleanURL ();
  final char [] ret = StringHelper.replaceMultiple (sURLPart, s_aCleanURLOld, s_aCleanURLNew);
  return new String (ret);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:17,代码来源:URLHelper.java

示例4: run

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public void run ()
{
  final char [] aSrc = new char [RSRC.length];
  for (int i = 0; i < RSRC.length; ++i)
    aSrc[i] = RSRC[i].charAt (0);
  final char [] [] aDst = new char [RDST.length] [];
  for (int i = 0; i < RDST.length; ++i)
    aDst[i] = RDST[i].toCharArray ();

  String s = "";
  for (int i = 0; i < m_nRuns; i++)
    s = new String (StringHelper.replaceMultiple (SRC, aSrc, aDst));
  if (!s.equals (DST))
    throw new IllegalStateException (s);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:16,代码来源:BenchmarkStringMultiReplace.java

示例5: getUnifiedStreet

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public static String getUnifiedStreet (@Nullable final String sStreet, @Nonnull final Locale aSortLocale)
{
  if (!isComplexAddressHandlingEnabled ())
    return sStreet;

  if (sStreet == null)
    return null;

  final String s = StringHelper.replaceMultiple (sStreet, STREET_SEARCH, STREET_REPLACE);
  return _unifyPart (s, aSortLocale);
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:13,代码来源:PostalAddressHelper.java

示例6: _prepareText

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * This method can only be called after loadedFont member was set!
 *
 * @param fAvailableWidth
 *        Available with
 * @param bAlreadyReplaced
 *        <code>true</code> if the text was already replaced
 * @return The new preparation size
 * @throws IOException
 *         On PDFBox error
 */
@Nonnull
private SizeSpec _prepareText (final float fAvailableWidth, final boolean bAlreadyReplaced) throws IOException
{
  final float fFontSize = m_aFontSpec.getFontSize ();
  m_fTextHeight = m_aLoadedFont.getTextHeight (fFontSize);
  m_fDescent = m_aLoadedFont.getDescent (fFontSize);

  if (hasNoText ())
  {
    // Nothing to do - empty
    // But keep the height distance!
    return new SizeSpec (0, m_fTextHeight);
  }

  // Split text into rows
  String sTextToFit;
  if (bAlreadyReplaced)
  {
    sTextToFit = m_sTextWithPlaceholdersReplaced;
  }
  else
  {
    // Use the approximations from the place holders
    sTextToFit = StringHelper.replaceMultiple (m_sOriginalText, ESTIMATION_REPLACEMENTS);
  }
  internalSetPreparedLines (m_aLoadedFont.getFitToWidth (sTextToFit, fFontSize, fAvailableWidth));

  // Determine max width of all prepared lines
  float fMaxWidth = Float.MIN_VALUE;
  for (final TextAndWidthSpec aTWS : m_aPreparedLines)
    fMaxWidth = Math.max (fMaxWidth, aTWS.getWidth ());

  // Determine height by number of lines
  return new SizeSpec (fMaxWidth, getDisplayHeightOfLineCount (m_aPreparedLines.size ()));
}
 
开发者ID:phax,项目名称:ph-pdf-layout,代码行数:47,代码来源:AbstractPLText.java


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