c# - C#中字符串中字符的左侧

标签 c#

如何在 C# 中从 emailID 字符串“feedback@abc.com”中获取“@”字符的左侧

谢谢

最佳答案

string email = "feedback@abc.comm";
int index = email.IndexOf("@");
string user = (index > 0 ? email.Substring(0, index) : "");

关于c# - C#中字符串中字符的左侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2971055/

相关文章:

c# - 在 C# 中创建数据对象来保存表中的值

c# - 将文字编码不正确的字符串(例如 "ñ")转换为 ISO-8859-1 (Latin1) H

c# - 所有方法的委托(delegate)

c# - 简单的词法解析器

c# - WPF 文本框性能

c# - 如何将自定义类保存/序列化到设置文件?

c# - 合并具有相同主键的行并计算新值的平均值

C#MVC : Search Grid as Partial View to enable AJAX Return?

c# - SQL 标识增量和种子

c# - 如何在 ASP.Net Core MVC 应用程序中获取 Action 和 Controller 名称?