Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::String::erase() troubles.  (Read 2498 times)

0 Members and 1 Guest are viewing this topic.

Austin J

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
sf::String::erase() troubles.
« on: November 18, 2013, 04:45:13 am »
SFML 2.1 - Static
Windows 7 - 64 bit

No matter how I go about it, sf::String::erase() doesn't work properly for me. Whenever I use it rather than erase the character it just replaces it with a box.

(I am filtering out backspace)

sf_string.erase(sf_string.getSize()-1,1); // Results in box first press then nothing afterwards(No size change)
 

std_string1 = sf_string;
std_string1.erase(std_string1.size()-1,1);
sf_string = std_string1; // Same results
 

I've tried other ways and it doesn't matter how I go about it I get this damned box.

Any help appreciated, thanks.

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: sf::String::erase() troubles.
« Reply #1 on: November 20, 2013, 09:03:57 pm »
From what I can tell from your code the you are telling your string to erase only the 2nd to last item in it.  If this isn't your intention maybe you should brush up on how to correctly use the str.erase() method works. String::Erase

Estivo

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: sf::String::erase() troubles.
« Reply #2 on: November 20, 2013, 10:42:40 pm »
try this
sf_string.erase(sf_string.end()-1);