字符串解析

解析用空格分隔单词的字符串:

void Analysis(char string[])
{
	if(string == NULL)
	{
		return;
	}

	int index = 0;

	while(isspace(string[index]))
	{
		index++;
	}

	int startIndexOfWord = index;
	int endIndexOfWord;

	while(string[index] != '')
	{
		if(isspace(string[index]))
		{
			endIndexOfWord = index - 1;
			ParseWord(string,startIndexOfWord,endIndexOfWord);
			
			index++;
			while(isspace(string[index]))
			{
				index++;
			}
			startIndexOfWord = index;
		}
		else
		{
			index++;
		}
	}
}

  

原文地址:https://www.cnblogs.com/laifeiyao/p/3473759.html