比如这么一行字符串3"Freisasse"500"privileges/ps_03_freisasse.lua"22150|我想改变成3"Freisasse"50000"privileges/ps_03_freisasse.lua"22150|也即第三个数字X100,请问怎么写?谢谢,网上找到的例子都是简单的全部替换,这里面很多数字只要替换一个就行了。源文本1"Unfreier"0""000|2"Gemeiner"250"privileges/ps_02_gemeiner.lua"110|3"Freisasse"500"privileges/ps_03_freisasse.lua"220|4"Beisasse"2000"privileges/ps_04_beisasse.lua"240|5"Buerger"6000"privileges/ps_05_buerger.lua"370|6"Freibuerger"15000"privileges/ps_06_freibuerger.lua"3100|7"Patrizier"30000"privileges/ps_07_patrizier.lua"4150|8"Edelmann"80000"privileges/ps_08_edelmann.lua"4301|9"Freiherr"150000"privileges/ps_09_freiherr.lua"5451|10"Baron"300000"privileges/ps_10_baron.lua"5552|11"Graf"600000"privileges/ps_11_graf.lua"51002|12"Markgraf"1000000"privileges/ps_12_markgraf.lua"52003|13"Fuerst"1500000"privileges/ps_13_fuerst.lua"55004|14"Reichsfuerst"2000000"privileges/ps_14_reichsfuerst.lua"59995|放一下我的处理代码,privateStringSecondNumber(Strings,Strings2){booleanflag=false;booleanflag1=false;for(inti=0;i<s.length();i++){if(s.charAt(i)'9'){flag=true;}if(flag==true&&s.charAt(i)>='0'&&s.charAt(i)<='9'){flag1=true;}if(flag==true&&flag1==true&&(s.charAt(i)'9')){StringBuffersb=newStringBuffer(s);returnsb.insert(i,s2).toString();}}returnnull;}SecondNumber(s,"00");Sostupid!
HUX布斯
阿波罗的战车
相关分类