2014-11-08 88 views

回答

0

举个例子。请先尝试在互联网上搜索解决方案。如果找不到直接的解决方案,请在此论坛中提问。

不是C#的确切代码,而是将其视为伪代码。有很多方法可以做到这一点。

// First method 
int first_index_of = s.find(input_String); 
String temp = input_String.substr(first_index_of, input_String.length); 
temp = temp.replace("Old", "New"); 
input_String = input_String.substring(0,first_index_of) + temp; 

//第二种方法

int i = 0; 
while (didn't reach end of string){ 
find next occurrence starting from index i 

// Ignore the first occurrence and Replace all other occurrences 
if (Ctr >1) 
    replace the string 

// Exit if no more sub strings found 
} 

这些都只是伪代码。我希望你在使用它之前先做一些工作。