小编Dan*_*Dan的帖子

BASH tr命令

我喜欢将其转换为大写,以便进行格式化,因此它将遵循未来的case语句.我认为案例陈述是区分大小写的.

我看到tr命令与echo命令一起使用的所有地方为你提供了立即的结果,例如:

echo "Enter in Location (i.e. SDD-134)"
read answer (user enters "cfg"

echo $answer | tr '[:lower:]' '[:upper:]'   which produced

cfg # first echo not upper?

echo $answer #echo it again and it is now upper...

CFG
Run Code Online (Sandbox Code Playgroud)

linux bash scripting case tr

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

C#使用未分配的局部变量....困惑

尝试使用此for循环进行迭代,并将int从用户输入到数组中.我收到错误,不明白为什么..

错误:错误1使用未分配的局部变量'array'

using System;

namespace Lab16
{
class Program
{
    static void Main(string[] args)
    {
        int[] array;
        int value;

        Console.Write("How big of an Array? ");
        int arraySize = int.Parse(Console.ReadLine());

        for (int i = 0; i <= arraySize; i++)
        {
            Console.Write("First Value: ");
            value = int.Parse(Console.ReadLine());
       -->  array[i] = Convert.ToInt32(value);

        }
    }
}
}
Run Code Online (Sandbox Code Playgroud)

c# arrays for-loop

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

标签 统计

arrays ×1

bash ×1

c# ×1

case ×1

for-loop ×1

linux ×1

scripting ×1

tr ×1