Example #1
0
bool CIwGameString::SplitFilename(CIwGameString& filename, CIwGameString& ext)
{
	int index = 0;
	
	// Find the dot
	for (int t = GetLength() - 1; t != 0; t--)
	{
		if (*(Data + t) == '.')
		{
			index = t;
			break;
		}
	}
	if (index == 0) return false;
	
	filename.Copy(Data, 0, index);
	ext.Copy(Data, index + 1, GetLength() - index - 1);
	
	return true;
}
Example #2
0
CIwGameXmlStringList* CIwGameXmlAttribute::GetValueAsList()
{
	CIwGameXmlStringList* pList = new CIwGameXmlStringList;
	
	// Separate Value by commas
	int			len = Value.GetLength();
	const char* text = Value.c_str();
	char		c;
	
	while ((c = *text++) != 0)
	{
		// Find a none white space
		if (c != ' ' && c != '\t' && c != '\n' && c != ',')
		{
			int count = 0;
			const char* found = text;
			
			// Find end of string
			while (count++ < 63)
			{
				c = *text;
				if (c == '\n' || c == ',' || c == 0)
					break;
				text++;
			}
			int len = text - found;
			if (len > 0)
			{
				CIwGameString *pString = new CIwGameString();
				pString->Copy((char*)found, 0, len);
			
				pList->push_back(pString);
			}
		}
	}

	return pList;
}