Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列内の英数字以外のすべての文字をダッシュに置き換えるか、単一引用符とアンダースコアの場合は何も置き換える必要はありません。regex クラスを使用して C# でこれを行う方法に関する提案はありますか?
var result = System.Text.RegularExpressions.Regex.Replace(input, @"[^a-zA-Z0-9]", m =>(m.Value == "'" || m.Value == "_") ? "" : "-");
次の方法を使用して、対話型環境にコマンドを挿入したいと考えています。
bc <<END 1+1 quit END
この例の出力は ' 2' で、入力後に表示されますEND。この出力を抑制したいとします。したがって、END と入力した後、出力を表示したくありません。どうす
2
END