C++ SFML是否添加到sf::字符串?

C++ SFML是否添加到sf::字符串?,c++,sfml,C++,Sfml,所以我最近一直在使用SFML,我想知道如何“添加”到sf::String 例如: sf::String exampleText; exampleText.SetText("I say: "); exampleText += "Blah"; 结果:“我说:废话” 试试看。不过,我从未使用过sf GetUnicodeText返回std::wstring。通过使用+,它可以工作。试试看 或者(现在我更好地看到了sf文档) exampleText.SetText(exampleText.GetText

所以我最近一直在使用SFML,我想知道如何“添加”到sf::String

例如:

sf::String exampleText;
exampleText.SetText("I say: ");
exampleText += "Blah";
结果:“我说:废话”

试试看。不过,我从未使用过
sf

GetUnicodeText
返回
std::wstring
。通过使用
+
,它可以工作。试试看

或者(现在我更好地看到了sf文档)

exampleText.SetText(exampleText.GetText()+“Blah”)

GetText()
返回std::string
SetText()
接受
wstring
string

sf::string不提供有意义的append方法,因为它是一个用于文本图形显示的类,而不是传统的string类


因此,您必须使用常用的char数组/string/stringstream类在后台执行字符串操作/追加操作,然后调用sf::string::SetText对其进行更新。

-1因为GetUnicodeText()显然不是sf::string的成员。;)总部的人告诉我我需要更多的睡眠。我应该开始听他们的。谢谢。没问题,我知道那种感觉:D
sf::String exampleText;
exampleText.SetText("I say: ");
std::wstring toAppend(L"Blah");
exampleText.SetText(exampleText.GetUnicodeText() + toAppend);