5

私は文字列を持っています.SQLでは、この文字列に印刷できない文字が含まれていることをテストしましたが、どれがそれらであるかを見つけることができませんでした.

では、この文字列を渡すことで、C# で印刷できない文字を見つけて印刷する方法を教えてもらえますか?

Taurus を 8 月に注文しましたが、まだ予定がありません。注文に何か問題があるのでしょうか? または、キューが単に長い場合は? 注文番号:8028 車両担当者:74J タグ番号: 200L049 説明: 2011 TAURUS FWD SEL 注文: 2010 年 8 月 8 日 VIN 割り当て済み:VIN#: 予定: 生産中: 生産済み: 請求済み: リリース済み: 出荷済み: 準備完了: 課税場所: ミシガン州 (20 )被保険者の状態:USOB ステータス:050 - 予定外の注文のクリーニング

文字列をメモ帳++に貼り付けると、次のように表示されます。

ここに画像の説明を入力

4

2 に答える 2

10

char.IsControl(c)文字が制御 (印刷不可) 文字かどうかをテストするために使用できます。

foreach (var c in str)
{
    if (char.IsControl(c))
    {
        Console.WriteLine("Found control character: {0}", (int)c);
    }
}
于 2012-06-21T12:28:01.387 に答える
0

私はグーグルとSOの助けを借りてプログラムを書きました。

このプログラムは、ASCII値と、印刷できない文字の位置を印刷します。

class Program
    {
        static void Main(string[] args)
        {

            string text = @"I am an FMCC employee located in the Chicagoland area that currently has 2 available/active ManagementLease tags (non-incremental) and 1 currently utilized Sales Vehicle tag. I have a 2009 Sales vehicle now andhave ordered a replacement for that vehicle (2010 Taurus) per our current direction. I have not had a 2009  Model vehicle for either of my Management Lease tags in 2009. I was married in August of this year andordered a 2010 Flex on one of my Management Lease tags in September.My issue is that my wife's current vehicle is no longer serviceable, and the 2010 Flex has yet to be scheduled tobe built.My exception request is that I be allowed to take delivery and assume payments for a 2010 Taurus that is at alocal dealership and displayed on the ""Vehicles Available Now"" page on an interim basis until my 2010 Flex isdelivered. I appreciate that typically an employee cannot have two vehicles from the same model year on agiven Management Lease tag, but I was hoping an exception could be made due to my recent marriage andthe fact that I did not have a 2009 model year vehicle on any tags.";
            for (int i = 0; i < text.Length; i++)
            {
                if (Char.ConvertToUtf32(text, i) < 32)
                {
                    Console.WriteLine( "position " + i + " " + text[i] + " => " + Char.ConvertToUtf32(text, i));
                }
            }
            Console.ReadLine();

        }
    }
于 2012-06-21T12:43:49.710 に答える