如何找到一个特殊字符串并替换该字符串 [英] how to ffind a particualr string and replace that string

查看:74
本文介绍了如何找到一个特殊字符串并替换该字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi



i有一个字符串作为示例如下所示



setVar1_Variable.set(setVar1_Variable_Value, comment ='setVar1_Variable_Comment',report = 0,format ='%s')



这个我想找到字符串setVar1_Variable并希望用新字符串替换这个字符串..



并且不想在setVar1_Variable_Value和'setVar1_Variable_Comment'中进行任何更改。



请帮忙我这个.......

hi

i have a string as example as shown below

setVar1_Variable.set(setVar1_Variable_Value, comment= 'setVar1_Variable_Comment', report= 0, format= '%s')

in this i want to find the string setVar1_Variable and want toreplace this string with new string ..

and dont want to make any change in setVar1_Variable_Value and 'setVar1_Variable_Comment'.

please help me on this.......

推荐答案

String.Replace(string,string) [ ^ ]



String.Replace(string,string)[^]

string myString = "The word cool is replaced in this string";
string newString = myString.Replace("cool", "awesome");





newstring现在等于在这个字符串中替换了awesome这个词



newstring now equals "The word awesome is replaced in this string"


这篇关于如何找到一个特殊字符串并替换该字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆