Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

print non-printable characters in a given string?

I've a string, In sql I've tested this string contains non-printable characters but I couldn't find which are those.

So can anyone suggest me how can i find and print those non-printable characters in C# by passing this string?

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

As i pasted the string in notepad++ it shows like this.

enter image description here

like image 894
Vishwanath Dalvi Avatar asked Jun 21 '12 12:06

Vishwanath Dalvi


People also ask

How do you find non printable characters in Python?

Python String isprintable() Method The isprintable() method returns True if all the characters of the given string are Printable. It returns False even if one character is Non-Printable. The uppercase and lowercase alphabets, numerical values, symbols, and empty string all come under printable characters.

How can I check all characters in a string is printable?

The isprintable() method returns “True” if all characters in the string are printable or the string is empty, Otherwise, It returns “False”. This function is used to check if the argument contains any printable characters such as: Digits ( 0123456789 ) Uppercase letters ( ABCDEFGHIJKLMNOPQRSTUVWXYZ )


1 Answers

You can use char.IsControl(c) to test whether a character is a control (non-printable) character or not:

foreach (var c in str)
{
    if (char.IsControl(c))
    {
        Console.WriteLine("Found control character: {0}", (int)c);
    }
}
like image 83
Kent Boogaart Avatar answered Oct 24 '22 01:10

Kent Boogaart