如何找到字符串的索引并在它们之间填充另一个字符串? [英] how to find the index of the string and fill another string between them?

查看:81
本文介绍了如何找到字符串的索引并在它们之间填充另一个字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友



我有字符串赞



Str1 =我是{ }我想玩{}我会得分{};





现在我想通过插入替换括号确切位置的另一个刺痛



后该字符串看起来像


我是{ joe}我想玩{FootBall}我会得分{5 golas};



这个例子



首先我想找到我想要定位另一个字符串之后字符串中是否有任何括号

Hi Friends

I Have String Like

Str1= i am a { } and i want to play { } i will score { };


now i want replace the brackets by inserting another sting in the exact position

after that string looks like

i am a {joe} and i want to play { FootBall } i will score { 5 golas };

this example

first i want to find how any brackets are there in a string after the i want to position the another string

推荐答案

使用string.Format() [ ^ ]。


string msg = string.Format("I am {0} and I want to play {1}, I will socore {3}", var1, var2, var3);


计算字符串的出现次数{}


这篇关于如何找到字符串的索引并在它们之间填充另一个字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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