git bisect通过计算"好"和"坏"之间的提交数量并检查中间的变化来工作.不幸的是,这对于repo来说效果不好,因为一个项目(例如框架)可能在早期就有很多变化而另一个项目(例如内核)可能会有一堆后来的变化,所以'repo forall -c"git bisect .. "'可能有一个项目在一个比其他国家更老的州检查出来.
我的问题是,是否有一种方法可以让git-bisect根据提交日期选择提交,所以当跨项目完成时,我们最有可能留在一个干净地编译的状态.
只是想知道在字符串上替换匹配的最佳方法.
value.replace("bob", "fred");
Run Code Online (Sandbox Code Playgroud)
例如,工作,但我希望每个"bob"实例替换为我存储在数组中的随机字符串.只是进行正则表达式匹配会返回匹配的文本,但不允许我在原始字符串中替换它.有一个简单的方法吗?
例如,我希望字符串:
"Bob went to the market. Bob went to the fair. Bob went home"
Run Code Online (Sandbox Code Playgroud)
也许会弹出来
"Fred went to the market. John went to the fair. Alex went home"
Run Code Online (Sandbox Code Playgroud) 我有一个简单的文件读写功能.
private void WriteToFile(String filename, String val) {
PrintWriter outStream = null;
FileOutputStream fos = null;
try {
fos = new FileOutputStream(filename);
outStream = new PrintWriter(new OutputStreamWriter(fos));
outStream.print(val);
outStream.close();
} catch (Exception e) {
if (outStream != null) {
outStream.close();
}
}
}
private String ReadFile(String filename) {
String output = "";
FileReader fr = null;
BufferedReader br = null;
try {
fr = new FileReader(filename);
br = new BufferedReader(fr);
output = br.readLine();
br.close();
} catch (Exception e) {
if …Run Code Online (Sandbox Code Playgroud) android ×1
git ×1
java ×1
javascript ×1
linux ×1
linux-kernel ×1
regex ×1
sdk ×1
windows ×1
windows-xp ×1