DEV Community

Piler
Piler

Posted on

1

[Unity] Remove non-visible characters/Weird string behavior

using System;
using System.Text.RegularExpressions;

string input = "Hello\u200B World\u200C!"; // Example string with non-visible characters

string result = Regex.Replace(input, @"\p{C}+", ""); // Remove non-visible characters

Console.WriteLine(result); // Output: Hello World!
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay