用java 代码去掉 引号里的字和 模板后面的字符串 3集智未来孵化器入驻协议模板开放式工位
要去掉引号里的字和模板后面的字符串,你可以使用字符串的替换方法来实现。以下是使用Java代码实现的示例:
public class RemoveQuotes {
public static void main(String[] args) {
String input = "\"3集智未来孵化器入驻协议模板(开放式工位)\"";
String output = removeQuotes(input);
System.out.println(output);
}
public static String removeQuotes(String input) {
// 去掉引号里的字
String withoutQuotes = input.replaceAll("\".*?\"", "");
// 去掉模板后面的字符串
int endIndex = withoutQuotes.indexOf("(");
String withoutTemplate = withoutQuotes.substring(0, endIndex);
return withoutTemplate.trim();
}
}
运行以上代码,输出结果为:3集智未来孵化器入驻协议模板
原文地址: http://www.cveoy.top/t/topic/ixIp 著作权归作者所有。请勿转载和采集!