What is this character?

I am trying to make an auto fill, so that when a player types a certain character, they get a drop down and after the player presses enter to confirm the drop-down choice it fills in rest of the word.

Every time the player types a letter, it loops through each character to check if it is a key character, so that the code can activate the drop-down, but if I type something like @AlbertSeir (where ‘@’ is the key character), I want a space to come after it so that next time my code loops and finds that ‘@’, it knows the player isn’t editing that phrase anymore. The only problem is, before I could even code it to add that extra space, a character appears that acts as a space, but my code doesn’t recognize its existence:

If you notice, there seems to be a ‘space’ at the end of @AlbertSeir, but when I wrote code to print the last character in the TextBox’s text, it returns ‘r’ (I also tried testing it to see if it was a linebreak using /n, but my code returns as nil). Here is my code for filling in the text:

-- This is a function that is called after the player presses enter
-- foundCharacter = the location of the key character
-- fillLocation = the location of the word the player is typing to fill

local function selectGuess(replacement)
    _chatFillBox.Visible = false
    local fillLocation = string.sub(_chatBar.Text, foundCharacter, string.len(_chatBar.Text))
    _chatBar.Text = string.gsub(_chatBar.Text, fillLocation, replacement)
    foundCharacter = nil
    _chatBar:CaptureFocus()
end

Also, when I print the TextBox’s text, I get this:

 '@AlbertSeir
'  -  Studio
1 Like

What outputs when you print replacement?
Does it print out the weird thing at the end as well?

A line break is a backwards slash, \n