想从字符串中提取子字符串 [英] want to extract a substring from string

查看:98
本文介绍了想从字符串中提取子字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hii

i有一个字符串abc@gmail.com

i只想从中提取gmail

如何搜索索引直到我到达@并且我怎么能搜索索引直到我得到。

然后我从中提取gmail ..

help

hii
i have a string abc@gmail.com
i want to extract only gmail from it
how can i search of index till i reach @ and how can i search for index till i get .
and then i extract gmail from it..
help

推荐答案

首先,如果您无法从字符串中提取子字符串而不提出任何问题,那么您就不准备使用邮件和任何其他高级内容,包括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);
           }


这篇关于想从字符串中提取子字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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