
AI
namespace GetNumberOfString{ class Program { static void MAIn(string[] args) { string input = sdfsdf2132kkk2323kk24; int[] getNumber = GetNumber(input) foreach (var i in getNumber) { Console.WriteLine(i); } Console.ReadLine(); }
public static int[] GetNumber(string getString) { var intRegEx = new RegEx([0-9]+); var intMatches = intRegEx.Matches(getString); int count = 0; var result = new int[intMatches.Count]; foreach (Match intMatche in intMatches) { result[count++] = Convert.ToInt32(intMatche.Value); } return result; } }}
Copyright © 2025 IZhiDa.com All Rights Reserved.
知答 版权所有 粤ICP备2023042255号