コード例 #1
0
static vsString ExtractStringToken( vsString &string )
{
	vsString token;
	size_t index = string.find(' ');
	
	if ( index == vsString::npos )
	{
		token = string;
		string = "";
	}
	else
	{
		token = string.substr(0, index);
		string.erase(0,index+1);
//		string = string.substr(index, vsString::npos);
	}
	
	return token;
}
コード例 #2
0
static vsString ExtractWhitespaceStringToken( vsString &string )	// pull out a string defined by whitespace
{
	vsString label;

	size_t len = string.length();
	size_t index = 0;

	for ( index = 0; index < len; index++ )
	{
		if ( IsWhitespace(string[index]) )	// this character isn't alphabetic, so isn't part of the label
		{
			index--;					// back up one character
			break;						// exit the loop
		}
	}

	label = string.substr(0, index+1);
	string.erase(0,index+1);

	return label;
}
コード例 #3
0
static vsString ExtractNumberToken( vsString &string )
{
	vsAssert(IsNumeric(string[0]), "Tried to extract a number from something that isn't a number!");
	// okay.  We need to find
	vsString numberString;

	size_t len = string.length();
	size_t index = 0;

	for ( index = 0; index < len; index++ )
	{
		if ( !IsNumeric(string[index]) )	// this character isn't alphabetic, so isn't part of the label
		{
			index--;					// back up one character
			break;						// exit the loop
		}
	}

	numberString = string.substr(0, index+1);
	string.erase(0,index+1);

	return numberString;
}