本文介绍了从ArrayList获取数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ArrayList al = new ArrayList();


string name =我的名字是tanzeel,我的全名是TANZEEL ahmed"


string name="my name is tanzeel and my complete name is TANZEEL ahmed"

for (int i = 0; i < name.Length; i += name.ToLower().IndexOf("tanzeel") + 7)
{
    int a = name.ToLower().IndexOf("tanzeel", i);
    al.Add((string)(name.Substring(a, 7)));
}


现在在此程序中,我已经将tanzeel的名称保存在字符串中,因为在我的字符串中,它以小写字母tanzeel的2倍出现,而其他以大写字母开头的则是2倍.所以我已经将它们存储在数组中.现在,我想从数组中替换相同的单词,这意味着首先用小写字母tanzeel替换一个单词,然后在找到TANZEEL的地方应以存储在数组中的大写字母TANZEEL开头.有什么办法吗?


now in this program i have stored the name tanzeel as it is in the string since in my string it comes 2 times one with small letter tanzeel and other starting with capital letter. so i have stored them as it is in an array. now i want to replace the same word from an array means first time a word with small letter tanzeel and then where it finds TANZEEL should replace with starting with capital letter TANZEEL as stored in an array. Is there any way?

推荐答案


这篇关于从ArrayList获取数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 15:06