c# - C#中如何从字符串中提取字符串

标签 c# string extract

VS 2015,c#。 我有一根绳子...

string str = "Name;IPAddress";

我只想提取 IP 地址。 我怀疑正则表达式是最好的方法,但我不确定。

非常感谢任何帮助。

最佳答案

您可以使用Split

string str = "Name;IPAddress";
string[] both = str.Split(';');
string name = both[0];
string ipadd = both[1];

关于c# - C#中如何从字符串中提取字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35076508/

相关文章:

c# - 查找函数调用者

c# - 在 vNext 中从类库访问 appsetting.json 或 config.json

c# - Expression.Convert 在 Expression.TryCatch 中

php - 如何在 PHP 中去除尾随零

virtualbox - 如何从 VDI 中提取文件

r - 在R中,如何根据列属性的统计信息选择行?

c# - Windows Phone 8.1 数据绑定(bind) ListView [XAML]

java - 用空格分隔每个大写单词

C# DataGridView.Rows.ToString() 方法

python - 从 docx 文件中提取 python 代码块并在沙箱中运行它们的安全方法是什么?