c#或oop中的功能 [英] fuction in c# or oop

查看:83
本文介绍了c#或oop中的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我有一个名为输入字符串的字符串,我有像a,b,c,d等字符...现在我想为另一个字符串编写函数,如输出字符串,前10个字符的那个输入字符串然后空格然后再输入该输入字符串的另外10个字符

现在对于那些在阅读此内容后写评论的人请在你的qwn做这是功课你不想把功课放在代码项目上我已经尝试了

now i have one string named input string in that i have characters like a,b,c,d .....upto z now i want to write function for another string like output string that have first 10 characters of that input string then space and then another 10 characters of this input string
now for those who will write comment after reading this please do at your qwn this is homework you are not suppose to put homework on code project for them i have tried

string output;
 function Getstring(string input)
{
  string input="abcdefghijklmnopqrstuvwxyz";
   output.substring(0,10);
   return output;

} 



所以我可以输出像abcdefghij

纠正我,如果我错了,但空间怎么样然后又一个10个字符?请帮帮我。


so may i get output like abcdefghij
correct me if i m wrong but what about space and then after another 10 charecters?? please help me .

推荐答案

如果这是C#代码那么

--------------- --------------------------

正确代码

------ ------------

If this is C# code then
-----------------------------------------
Correct code
------------------
private string Getstring(string inStr)
{
  string input=inStr;
  string  output =input.substring(0,10);
  return output;
}











这里是你的粗体错误








here is your mistake in bold

function Getstring(string input)
{
string input="abcdefghijklmnopqrstuvwxyz";
output.substring(0,10);
return output;

}


这篇关于c#或oop中的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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