对C Sharp的怀疑 [英] Doubt in C Sharp
本文介绍了对C Sharp的怀疑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给我一个程序来接受字符串,然后将输入的字符串按计数除以2.
例如:输入字符串为"Indiana"
输出为:In,nd,di,ia,an,na
hi ,
give me a program to accept the string and split the input string by count by 2.
for ex:input string is"Indiana"
the output is:In,nd,di,ia,an,na
推荐答案
毫无疑问,您的请求是无耻的"gimmecode"请求.
强大的.NET String
类提供完成此简单任务所需的所有方法.
提示:看看子字符串方法 [
That''s not a doubt, yours is a shameless ''gimmecode'' request.
The powerful.NET String
class provides all methods you need for completing such a simple task.
Hint: Have a look at Substring method[^].
:)
查找循环和字符串方法substring
链接 [
Look for loops and string method substring
link[^]
亲爱的,这很简单,不需要功能...这是我提高程序设计技巧的建议.
你在这里:
在此处查看ur示例的结果:
http://www.m76at.com/upload/image17217.html [
it''s quite simple my dear , no need for functions ... this is my advice to improve ur programming skills .
here u are :
see the result of ur Example here :
http://www.m76at.com/upload/image17217.html[^]
the code :
<pre lang="cs">private void button1_Click(object sender, EventArgs e)
{
int size;
string word = textBox1.Text;
size = word.Length;
char[] array = new char[size];
array = word.ToCharArray();
if (size % 2 != 0)
size += 1;
for (int i = 0; i < size-2; i += 2)
{
textBox2.Text += array[i].ToString() + array[i + 1].ToString() + ",";
}
}
这是源代码:
http://www.zshare.net/download/836108228e67fdfd/
祝你好运:)
this is the source code :
http://www.zshare.net/download/836108228e67fdfd/
good luck :)
这篇关于对C Sharp的怀疑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文