Returns a string with resolved iOS placeholders.
@param original the original text
@return The text with resolved iOS placeholders (if there were some).
544818
protected String resolveIOSPlaceholders(String original) {
    int index = 1;
    String resolved = original;

    final Pattern pattern = Pattern.compile("%[a-zA-Z@]");
    final Matcher matcher = pattern.matcher(original);
    while (matcher.find()) {
      String placeholderIOS = matcher.group();
      String placeholderAndroid = placeholderMap.get(placeholderIOS);
      if (placeholderAndroid != null) {
        placeholderAndroid = String.format(placeholderAndroid, index++);
        resolved = resolved.replaceFirst(placeholderIOS, placeholderAndroid);
      }
    }

    return resolved;
  }
469769
public static String replaceCRToken(final String original) {
        String toReplace = original;

        if (original != null && original.indexOf(NEWLINE_TOKEN) >= 0) {
            toReplace = StringUtil.replace(NEWLINE_TOKEN, NEW_LINE, original);
        }

        return toReplace;
    }
710642
public static function maybeUnSerialize($original)
    {
        if (! is_string($original) || trim($original) == '') {
            return $original;
        }

        /**
         * Check if serialized
         * check with trim
         */
        if (self::isSerialized($original)) {
            /**
             * use trim if possible
             * Serialized value could not start & end with white space
             */
            return @unserialize(trim($original));
        }

        return $original;
    }
196778
protected String rewriteContentString(String originalContent) {

        Pattern uuidPattern = Pattern.compile(CmsUUID.UUID_REGEX);
        I_CmsRegexSubstitution substitution = new I_CmsRegexSubstitution() {

            public String substituteMatch(String text, Matcher matcher) {

                String uuidString = text.substring(matcher.start(), matcher.end());
                CmsUUID uuid = new CmsUUID(uuidString);
                String result = uuidString;
                if (m_translationsById.containsKey(uuid)) {
                    result = m_translationsById.get(uuid).getStructureId().toString();
                }
                return result;
            }
        };
        return CmsStringUtil.substitute(uuidPattern, originalContent, substitution);
    }
640941
def escapePlaceholders(self,inputString):
        
        escaped = inputString.replace(MapConstants.placeholder,'\\'+MapConstants.placeholder)
        escaped = escaped.replace(MapConstants.placeholderFileName,'\\'+MapConstants.placeholderFileName)
        escaped = escaped.replace(MapConstants.placeholderPath,'\\'+MapConstants.placeholderPath)
        escaped = escaped.replace(MapConstants.placeholderExtension,'\\'+MapConstants.placeholderExtension)
        escaped = escaped.replace(MapConstants.placeholderCounter,'\\'+MapConstants.placeholderCounter)
        return escaped
134179
protected String getPairPunctuationText( int c ) throws IOException 
    {
        //StringBuilder isb = new StringBuilder();
        isb.clear();
        char echar = StringUtil.getPunctuationPair( (char) c);
        boolean matched = false;
        int j, ch;
        
        //replaced with IntArrayList at 2013-09-08
        //ArrayList<Integer> chArr = new ArrayList<Integer>(config.PPT_MAX_LENGTH);
        ialist.clear();
        
        for ( j = 0; j < config.PPT_MAX_LENGTH; j++ ) {
            ch = readNext();
            if ( ch == -1 ) break;
            if ( ch == echar ) {
                matched = true;
                pushBack(ch);        //push the pair punc back.
                break;
            }
            
            isb.append( (char) ch );
            ialist.add(ch);
        }
        
        if ( matched == false ) {
            for ( int i = j - 1; i >= 0; i-- ) 
                pushBack( ialist.get(i) );
            return null;
        }
        
        return isb.toString();
    }
    
    /**
     * an abstract method to gain a CJK word from the 
     * current position. simpleSeg and ComplexSeg is different to deal this, 
     * so make it a abstract method here
     * 
     * @param  chars
     * @param  index
     * @return IChunk
     * @throws IOException
     */
    protected abstract IChunk getBestCJKChunk(char chars[], int index) throws IOException;
    
}
575555
public static String unCamelify(CharSequence original) {
		StringBuilder result = new StringBuilder(original.length());
		boolean wasLowercase = false;
		for (int i = 0; i < original.length(); i++) {
			char ch = original.charAt(i);
			if (Character.isUpperCase(ch) && wasLowercase) {
				result.append('-');
			}
			wasLowercase = Character.isLowerCase(ch);
			result.append(Character.toLowerCase(ch));
		}
		return result.toString();
	}
924206
@Deprecated
    public String getRegexEquivalent() {
        if (strings.size() == 0) {
            return toString();
        }
        StringBuilder result = new StringBuilder("(?:");
        appendNewPattern(result, true, false);
        for (String s : strings) {
            result.append('|');
            _appendToPat(result, s, true);
        }
        return result.append(")").toString();
    }
498343
static CTFont resolveFont (Font font) {
    CTFont ctFont = fonts.get(font == null ? DEFAULT_FONT : font);
    if (ctFont == null) {
      String iosName = getVariant(font.name, font.style);
      fonts.put(font, ctFont = CTFont.create(iosName, font.size, CGAffineTransform.Identity()));
    }
    return ctFont;
  }
1034025
public static String replaceAllSpecialChracters(String toBeReplaced) {
	toBeReplaced = toBeReplaced.replaceAll("&", "&amp;");
	toBeReplaced = toBeReplaced.replaceAll("<", "&lt;");
	toBeReplaced = toBeReplaced.replaceAll(">", "&gt;");
	toBeReplaced = toBeReplaced.replaceAll("\"", "&quot;");
	toBeReplaced = toBeReplaced.replaceAll("'", "&apos;");
	// toBeReplaced = toBeReplaced.replace("^", "&circ");
	// toBeReplaced = toBeReplaced.replaceAll("0xb", "");
	int len = toBeReplaced.length();
	char[] temp = toBeReplaced.toCharArray();
	for (int i = 0; i < len; i++) {
	    char xCode = temp[i];
	    if ((xCode > '\u0000' && xCode <= '\u0020') || (xCode == '\u0026')
		    || (xCode == '\u0022') || (xCode == '\u02C6')
		    || (xCode == '\u201C') || (xCode == '\u201D')
		    || (xCode == '\u201E')) {
		String sub1 = toBeReplaced.substring(0, i);
		String sub2 = toBeReplaced.substring(i + 1, len);

		String replacement = "";
		if ((xCode > '\u0000' && xCode <= '\u0020'))
		    replacement = " ";
		if (xCode == '\u0026')
		    replacement = " ";
		if (xCode == '\u0022')
		    replacement = " ";
		if (xCode == '\u02C6')
		    replacement = " ";
		if (xCode == '\u201C')
		    replacement = " ";
		if (xCode == '\u201D')
		    replacement = " ";
		if (xCode == '\u201E')
		    replacement = " ";

		toBeReplaced = sub1 + replacement + sub2;
	    }
	    len = toBeReplaced.length();
	    temp = toBeReplaced.toCharArray();
	}

	return (toBeReplaced);
    }
365892
public <B extends TextBoxBase> B setPlaceholderText (B box, String placeholder)
    {
        box.getElement().setAttribute("placeholder", placeholder);
        return box;
    }
787691
public String removeSuffix(String original, String suffix) {
        if (original.endsWith(suffix)) {
            return original.substring(0, original.length() - suffix.length());
        }
        return original;
    }
1259096
function extractPlaceholderToIds(messageBundle) {
	      var messageMap = messageBundle.getMessageMap();
	      var placeholderToIds = {};
	      Object.keys(messageMap).forEach(function (msgId) {
	          placeholderToIds[msgId] = messageMap[msgId].placeholderToMsgIds;
	      });
	      return placeholderToIds;
	  }
302653
private <L extends Collection<ContentUriPlaceHolder>> L extractPlaceHoldersFromURI(String uri, final L result) {
		final One<Boolean> valid = new One<>();
		valid.value0 = false;

		analyzeInternal(uri, new UriBaseListener() {

			@Override
			public void enterBind_parameter(Bind_parameterContext ctx) {
				result.add(new ContentUriPlaceHolder(pathSegmentIndex, ctx.bind_parameter_name().getText()));
			}

			@Override
			public void enterPath_segment(Path_segmentContext ctx) {
				pathSegmentIndex++;
			}

		});
		return result;
	}
224048
private int resolveCharEnt(StringBuffer originalCharacters)
        throws XMLStreamException
    {
        int value = 0;
        char c = getNextChar(SUFFIX_IN_ENTITY_REF);
        
        if (originalCharacters != null) {
            originalCharacters.append(c);
        }
        
        if (c == 'x') { // hex
            while (true) {
                c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++]
                    : getNextCharFromCurrent(SUFFIX_IN_ENTITY_REF);
                if (c == ';') {
                    break;
                }
                
                if (originalCharacters != null) {
                    originalCharacters.append(c);
                }
                value = value << 4;
                if (c <= '9' && c >= '0') {
                    value += (c - '0');
                } else if (c >= 'a' && c <= 'f') {
                    value += 10 + (c - 'a');
                } else if (c >= 'A' && c <= 'F') {
                    value += 10 + (c - 'A');
                } else {
                    throwUnexpectedChar(c, "; expected a hex digit (0-9a-fA-F).");
                }
                // Overflow?
                if (value > MAX_UNICODE_CHAR) {
                    reportUnicodeOverflow();
                }
            }
        } else { // numeric (decimal)
            while (c != ';') {
                if (c <= '9' && c >= '0') {
                    value = (value * 10) + (c - '0');
                    // Overflow?
                    if (value > MAX_UNICODE_CHAR) {
                        reportUnicodeOverflow();
                    }
                } else {
                    throwUnexpectedChar(c, "; expected a decimal number.");
                }
                c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++]
                    : getNextCharFromCurrent(SUFFIX_IN_ENTITY_REF);
                
                if (originalCharacters != null && c != ';') {
                    originalCharacters.append(c);
                }
            }
        }
        validateChar(value);
        return value;
    }
109322
public String getReplacedMazeString(List<Map<Point, Character>> replacements) {
        String[] stringMaze = toStringArray();
        for (Map<Point, Character> replacement : replacements) {
            for (Point p : replacement.keySet()) {
                int row = p.y;
                int column = p.x;
                char c = stringMaze[row].charAt(column);
                if (c != Symbol.START.value() && c != Symbol.GOAL.value()) {
                    stringMaze[row] = replaceChar(stringMaze[row], column, replacement.get(p));
                }
            }
        }
        String output = "";
        for (String line : stringMaze) {
            output += String.format("%s%n", line);
        }
        return output;
    }
275593
public String getOriginalText() {
    StringBuilder sb = new StringBuilder();
    for (TextPart part : parts) {
      if (part.getType() == TextPart.Type.TEXT) {
        sb.append(part.getPart());
      }
    }
    return sb.toString();
  }