mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
29 lines
756 B
C++
29 lines
756 B
C++
|
/*
|
||
|
* Util.cpp
|
||
|
* met - Minimum Error Training
|
||
|
*
|
||
|
* Created by Nicola Bertoldi on 13/05/08.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#include "Util.h"
|
||
|
|
||
|
int getNextPound(std::string &theString, std::string &substring, const std::string delimiter)
|
||
|
{
|
||
|
int pos = 0;
|
||
|
|
||
|
//skip all occurrences of delimiter
|
||
|
while ( pos == 0 )
|
||
|
{
|
||
|
if ((pos = theString.find(delimiter)) != std::string::npos){
|
||
|
substring.assign(theString, 0, pos);
|
||
|
theString.assign(theString, pos + delimiter.size(), theString.size());
|
||
|
}
|
||
|
else{
|
||
|
substring.assign(theString);
|
||
|
theString.assign("");
|
||
|
}
|
||
|
}
|
||
|
return (pos);
|
||
|
};
|