本文整理匯總了Java中java.lang.String.replace方法的典型用法代碼示例。如果您正苦於以下問題:Java String.replace方法的具體用法?Java String.replace怎麽用?Java String.replace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.String
的用法示例。
在下文中一共展示了String.replace方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createClassJcovElement
import java.lang.String; //導入方法依賴的package包/類
private String createClassJcovElement(Environment env, ClassDefinition c) {
String SourceClass = (Type.mangleInnerType((c.getClassDeclaration()).getName())).toString();
String ConvSourceClass;
String classJcovLine;
SourceClassList.addElement(SourceClass);
ConvSourceClass = SourceClass.replace('.', '/');
classJcovLine = JcovClassLine + ConvSourceClass;
classJcovLine = classJcovLine + " [";
String blank = "";
for (int i = 0; i < arrayModifiers.length; i++ ) {
if ((c.getModifiers() & arrayModifiers[i]) != 0) {
classJcovLine = classJcovLine + blank + opNames[arrayModifiersOpc[i]];
blank = " ";
}
}
classJcovLine = classJcovLine + "]";
return classJcovLine;
}
示例2: tokenizeRegexp
import java.lang.String; //導入方法依賴的package包/類
public static IEnumerable tokenizeRegexp(String input, String pattern, String flags)
{
int flag = 0;
String regex = pattern;
for (char c : flags.toCharArray())
{
switch(c)
{
case 's':
flag |= Pattern.DOTALL;
break;
case 'm':
flag |= Pattern.MULTILINE;
break;
case 'i':
flag |= Pattern.CASE_INSENSITIVE;
break;
case 'x':
regex = regex.replace(" ", "");
regex = regex.replace("\t", "");
regex = regex.replace("\n", "");
regex = regex.replace("\r", "");
break;
default:
throw new IllegalArgumentException( "regular expression flag \'" + c + "\' is illegal." );
}
}
Pattern re = Pattern.compile(regex, flag);
return new ArrayEnumerable(re.split(input, -1));
}
示例3: createComment
import java.lang.String; //導入方法依賴的package包/類
public static com.altova.mapforce.IMFNode createComment(String content)
{
String str = content.replace("--", "- -");
if (str.endsWith("-"))
str += " ";
return new com.altova.mapforce.MFComment(str);
}
示例4: createProcessingInstruction
import java.lang.String; //導入方法依賴的package包/類
public static com.altova.mapforce.IMFNode createProcessingInstruction(String content, String name)
{
if (!content.contains("?>"))
return new com.altova.mapforce.MFProcessingInstruction(content, name);
return new com.altova.mapforce.MFProcessingInstruction(content.replace("?>", "? >"), name);
}
示例5: convertFilenameToTitle
import java.lang.String; //導入方法依賴的package包/類
private static String convertFilenameToTitle(String filename){
String title = filename.substring(0, filename.lastIndexOf("."));
title = title.replace("Cant", "Can't");
return title;
}