小编Dov*_*das的帖子

当前上下文中不存在名称"文件"

我是c#编程的初学者.我正在接受错误The name 'File' does not exist in the current context.

问题必须在线 var v = File.ReadLines("dictionary.txt");

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                var v = File.ReadLines("dictionary.txt");
Run Code Online (Sandbox Code Playgroud)

.net c#

9
推荐指数
1
解决办法
2万
查看次数

正则表达式,从字符串中选择第一个数字

我有一个字符串

var str = "14??? 7???? 12??? 7????"; 
Run Code Online (Sandbox Code Playgroud)

我需要在字符串中选择第一个数字(14,7,12,7).

我编写了以下代码的代码,但是这段代码选择了分开的数字(1,4,7,1,2,7):

for (var i = 0; i < str.length; i++) {
    newStr = str.match(/\d/g);
}
Run Code Online (Sandbox Code Playgroud)

javascript regex string

1
推荐指数
1
解决办法
96
查看次数

标签 统计

.net ×1

c# ×1

javascript ×1

regex ×1

string ×1