///////////////////////////////////////////////////////////////////////////
| 104 | |
| 105 | //////////////////////////////////////////////////////////////////////////////// |
| 106 | std::vector<sf::String> explode(const sf::String& string, sf::Uint32 delimiter) |
| 107 | { |
| 108 | if (string.isEmpty()) |
| 109 | return std::vector<sf::String>(); |
| 110 | |
| 111 | // For each character in the string |
| 112 | std::vector<sf::String> result; |
| 113 | sf::String buffer; |
| 114 | for (sf::Uint32 character : string) |
| 115 | { |
| 116 | // If we've hit the delimiter character |
| 117 | if (character == delimiter) |
| 118 | { |
| 119 | // Add them to the result vector |
| 120 | result.push_back(buffer); |
| 121 | buffer.clear(); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | // Accumulate the next character into the sequence |
| 126 | buffer += character; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | // Add to the result if buffer still has contents or if the last character is a delimiter |
| 131 | if (!buffer.isEmpty() || string[string.getSize() - 1] == delimiter) |
| 132 | result.push_back(buffer); |
| 133 | |
| 134 | return result; |
| 135 | } |
| 136 | |
| 137 | void RichText::setCharacterSize(unsigned int size) |
| 138 | { |