Vb.net 如何在VisualBasic中查找文本框中的数字
我有一个文本框,文本是“ab1234de524sfe6985dsef456”,我想把这个数组中的所有数字都记下来 像Vb.net 如何在VisualBasic中查找文本框中的数字,vb.net,parsing,Vb.net,Parsing,我有一个文本框,文本是“ab1234de524sfe6985dsef456”,我想把这个数组中的所有数字都记下来 像 帮助我,谢谢您可以使用正则表达式。请查看以下用c编写的代码片段# 已转换为Visual Basic: Dim strRegex As String = "\d+" Dim myRegex As New Regex(strRegex, RegexOptions.Singleline) Dim strTargetString As String = "ab1234de524sfe69
帮助我,谢谢您可以使用正则表达式。请查看以下用c编写的代码片段#
已转换为Visual Basic:
Dim strRegex As String = "\d+"
Dim myRegex As New Regex(strRegex, RegexOptions.Singleline)
Dim strTargetString As String = "ab1234de524sfe6985dsef456"
Dim list As New ArrayList()
For Each myMatch As Match In myRegex.Matches(strTargetString)
If myMatch.Success Then
list.Add(myMatch.Value)
End If
Next
抱歉,我是tag c#,但我使用的是visual basic。你能帮我转换成visual basic吗,非常感谢这是Java代码:)如果你不知道如何转换@Lulu,你必须正确地标记你的问题。文本看起来像带分隔符s的十六进制数字。
string strRegex = @"\d+";
Regex myRegex = new Regex(strRegex, RegexOptions.Singleline);
string strTargetString = @"ab1234de524sfe6985dsef456";
ArrayList list=new ArrayList();
foreach (Match myMatch in myRegex.Matches(strTargetString))
{
if (myMatch.Success)
{
list.Add(myMatch.Value);
}
}
list.Dump();
Dim strRegex As String = "\d+"
Dim myRegex As New Regex(strRegex, RegexOptions.Singleline)
Dim strTargetString As String = "ab1234de524sfe6985dsef456"
Dim list As New ArrayList()
For Each myMatch As Match In myRegex.Matches(strTargetString)
If myMatch.Success Then
list.Add(myMatch.Value)
End If
Next