gpt4 book ai didi

c# - 在给定的字符串中打印不可打印的字符?

转载 作者:太空狗 更新时间:2023-10-30 00:26:26 25 4
gpt4 key购买 nike

我有一个字符串,在 sql 中我测试过这个字符串包含不可打印的字符,但我找不到那些字符。

那么谁能建议我如何在 C# 中查找和打印那些不可打印的字符通过传递这个字符串?

I ordered a Taurus in August and it hasn't been scheduled, I was just wondering if there is something wrong with the order? Or if the queue is just long? Order Number:8028Vehicle Rep:74JTag#: 200L049Description: 2011 TAURUS FWD SELOrdered: 08-AUG- 2010VIN Assigned:VIN#:Scheduled:In Production:Produced:Invoiced:Released:Shipped:Ready:Tax Location: STATE OF MICHIGAN (20 )State Insured:USOB Status:050 - CLEAN UNSCHEDULED ORDER

当我在 notepad++ 中粘贴字符串时,它显示如下。

enter image description here

最佳答案

您可以使用 char.IsControl(c) 来测试字符是否是控制(不可打印)字符:

foreach (var c in str)
{
if (char.IsControl(c))
{
Console.WriteLine("Found control character: {0}", (int)c);
}
}

关于c# - 在给定的字符串中打印不可打印的字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11137947/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com