本文整理了Java中java.util.regex.Matcher.appendEvaluated()
方法的一些代码示例,展示了Matcher.appendEvaluated()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matcher.appendEvaluated()
方法的具体详情如下:
包路径:java.util.regex.Matcher
类名称:Matcher
方法名:appendEvaluated
[英]Internal helper method to append a given string to a given string buffer. If the string contains any references to groups, these are replaced by the corresponding group's contents.
[中]将给定字符串附加到给定字符串缓冲区的内部帮助程序方法。如果字符串包含对组的任何引用,则这些引用将替换为相应组的内容。
代码示例来源:origin: robovm/robovm
/**
* Appends a literal part of the input plus a replacement for the current
* match to a given {@link StringBuffer}. The literal part is exactly the
* part of the input between the previous match and the current match. The
* method can be used in conjunction with {@link #find()} and
* {@link #appendTail(StringBuffer)} to walk through the input and replace
* all occurrences of the {@code Pattern} with something else.
*
* @param buffer
* the {@code StringBuffer} to append to.
* @param replacement
* the replacement text.
* @return the {@code Matcher} itself.
* @throws IllegalStateException
* if no successful match has been made.
*/
public Matcher appendReplacement(StringBuffer buffer, String replacement) {
buffer.append(input.substring(appendPos, start()));
appendEvaluated(buffer, replacement);
appendPos = end();
return this;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Appends a literal part of the input plus a replacement for the current
* match to a given {@link StringBuffer}. The literal part is exactly the
* part of the input between the previous match and the current match. The
* method can be used in conjunction with {@link #find()} and
* {@link #appendTail(StringBuffer)} to walk through the input and replace
* all occurrences of the {@code Pattern} with something else.
*
* @param buffer
* the {@code StringBuffer} to append to.
* @param replacement
* the replacement text.
* @return the {@code Matcher} itself.
* @throws IllegalStateException
* if no successful match has been made.
*/
public Matcher appendReplacement(StringBuffer buffer, String replacement) {
buffer.append(input.substring(appendPos, start()));
appendEvaluated(buffer, replacement);
appendPos = end();
return this;
}
代码示例来源:origin: MobiVM/robovm
/**
* Appends a literal part of the input plus a replacement for the current
* match to a given {@link StringBuffer}. The literal part is exactly the
* part of the input between the previous match and the current match. The
* method can be used in conjunction with {@link #find()} and
* {@link #appendTail(StringBuffer)} to walk through the input and replace
* all occurrences of the {@code Pattern} with something else.
*
* @param buffer
* the {@code StringBuffer} to append to.
* @param replacement
* the replacement text.
* @return the {@code Matcher} itself.
* @throws IllegalStateException
* if no successful match has been made.
*/
public Matcher appendReplacement(StringBuffer buffer, String replacement) {
buffer.append(input.substring(appendPos, start()));
appendEvaluated(buffer, replacement);
appendPos = end();
return this;
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Appends a literal part of the input plus a replacement for the current
* match to a given {@link StringBuffer}. The literal part is exactly the
* part of the input between the previous match and the current match. The
* method can be used in conjunction with {@link #find()} and
* {@link #appendTail(StringBuffer)} to walk through the input and replace
* all occurrences of the {@code Pattern} with something else.
*
* @param buffer
* the {@code StringBuffer} to append to.
* @param replacement
* the replacement text.
* @return the {@code Matcher} itself.
* @throws IllegalStateException
* if no successful match has been made.
*/
public Matcher appendReplacement(StringBuffer buffer, String replacement) {
buffer.append(input.substring(appendPos, start()));
appendEvaluated(buffer, replacement);
appendPos = end();
return this;
}
代码示例来源:origin: ibinti/bugvm
/**
* Appends a literal part of the input plus a replacement for the current
* match to a given {@link StringBuffer}. The literal part is exactly the
* part of the input between the previous match and the current match. The
* method can be used in conjunction with {@link #find()} and
* {@link #appendTail(StringBuffer)} to walk through the input and replace
* all occurrences of the {@code Pattern} with something else.
*
* @param buffer
* the {@code StringBuffer} to append to.
* @param replacement
* the replacement text.
* @return the {@code Matcher} itself.
* @throws IllegalStateException
* if no successful match has been made.
*/
public Matcher appendReplacement(StringBuffer buffer, String replacement) {
buffer.append(input.substring(appendPos, start()));
appendEvaluated(buffer, replacement);
appendPos = end();
return this;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Appends a literal part of the input plus a replacement for the current
* match to a given {@link StringBuffer}. The literal part is exactly the
* part of the input between the previous match and the current match. The
* method can be used in conjunction with {@link #find()} and
* {@link #appendTail(StringBuffer)} to walk through the input and replace
* all occurrences of the {@code Pattern} with something else.
*
* @param buffer
* the {@code StringBuffer} to append to.
* @param replacement
* the replacement text.
* @return the {@code Matcher} itself.
* @throws IllegalStateException
* if no successful match has been made.
*/
public Matcher appendReplacement(StringBuffer buffer, String replacement) {
buffer.append(input.substring(appendPos, start()));
appendEvaluated(buffer, replacement);
appendPos = end();
return this;
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Appends a literal part of the input plus a replacement for the current
* match to a given {@link StringBuffer}. The literal part is exactly the
* part of the input between the previous match and the current match. The
* method can be used in conjunction with {@link #find()} and
* {@link #appendTail(StringBuffer)} to walk through the input and replace
* all occurrences of the {@code Pattern} with something else.
*
* @param buffer
* the {@code StringBuffer} to append to.
* @param replacement
* the replacement text.
* @return the {@code Matcher} itself.
* @throws IllegalStateException
* if no successful match has been made.
*/
public Matcher appendReplacement(StringBuffer buffer, String replacement) {
buffer.append(input.substring(appendPos, start()));
appendEvaluated(buffer, replacement);
appendPos = end();
return this;
}
内容来源于网络,如有侵权,请联系作者删除!