How to remove U+FE6B (﹫) from a string?

72 Views Asked by At

I ran into a problem when the structure of the game chat of cs2 got changed.

I already changed the code accordingly, but for some reason I can't seem to get these lines of code to work:

/* removal of the team-chat location info. */
if (chatType == ChatType.Team)
{
    var idx = namePart.LastIndexOf('﹫'); // uFE6B

    if (idx != -1)
        namePart = namePart.Substring(0, idx).Trim();
}

Filtering like this works:

/* filter out the massage */
if (!l.Contains("[ALL]") && !l.Contains("﹫")) // uFE6B
    continue;

This is what the line in the log looks like:

image

I already tried using a Unicode escape sequence, but no luck.

2

There are 2 best solutions below

0
Matin On

I'm not quite sure what you want, but you can use regex to if you want to remove that character from strings:

using System.Text.RegularExpressions;

string input = "Your ﹫ string with ﹫ character";

// Regex pattern to match the character '﹫' (Unicode U+FE6B)
string pattern = @"\uFE6B";

// Replace the matched character with an empty string
string result = Regex.Replace (input, pattern, string.Empty);
0
paradox On

just fixed it myself... after posting the question I realized its looking to trim in chatType.Team and not namePart

like my grandpa always said:

Those who can read have a clear advantage