且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

想从字符串中提取子字符串

更新时间:2022-06-22 05:39:43

首先,如果您无法从字符串中提取子字符串而不提出任何问题,那么您就不准备使用邮件和任何其他高级内容,包括UI。您应该使用最简单的仅限控制台的应用程序进行编程基础的初级练习,这应该花费相当多的时间。



在这种情况下,您可以使用 string.Split

http://msdn.microsoft.com/en-us/library/system.string.split.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.string.aspx [ ^ ]。



-SA
First of all, if you cannot extract a substring from a string not asking any questions, you are not ready to work with mail and any other advanced stuff, including UI. You should do elementary exercises in programming basics using simplest console-only applications, which should take considerable amount of time.

In this case, you could use string.Split:
http://msdn.microsoft.com/en-us/library/system.string.split.aspx[^],
http://msdn.microsoft.com/en-us/library/system.string.aspx[^].

—SA


string Source = "abc@gmail.com";
char[] dest;
Source.CopyTo(3 ,dest,0,4);
console.write(Source);
console.writeline(dest);


是的我知道什么是电子邮件你应该试试

yeah i know what is email you should try it
string s = "sk.shrinet@gmail.com";

           string[] words = s.Split('@');
           foreach (string word in words)
           {
               Console.WriteLine(word);
           }