mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
Jon Parise's further modifications to join
This commit is contained in:
parent
409665cdbf
commit
61a41165bf
@ -2401,19 +2401,18 @@ expand_wordsubst(const string ¶ms) {
|
|||||||
string PPScope::
|
string PPScope::
|
||||||
expand_join(const string ¶ms) {
|
expand_join(const string ¶ms) {
|
||||||
// Split the string up into tokens based on the spaces.
|
// Split the string up into tokens based on the spaces.
|
||||||
vector<string> words;
|
vector<string> tokens;
|
||||||
tokenize_whitespace(expand_string(params), words);
|
tokenize_params(params, tokens, true);
|
||||||
|
|
||||||
if (words.size() < 2) {
|
if (tokens.size() != 2) {
|
||||||
cerr << "joins requires at least two parameters.\n";
|
cerr << "join requires two parameters.\n";
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
const string sep(words[0]);
|
const string &sep = tokens[0];
|
||||||
|
vector<string> words;
|
||||||
|
tokenize_whitespace(expand_string(tokens[1]), words);
|
||||||
|
|
||||||
// Remove the first word in the list (which we use as the separator).
|
|
||||||
words.erase(words.begin());
|
|
||||||
|
|
||||||
string result = repaste(words, sep);
|
string result = repaste(words, sep);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user