View Single Post
Old May 8th, 2006, 10:26 AM   #9
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
An alternative to the switch statement for symbols would be to base if off ASCII ranges or have a string of symbols and utilize the "find_first_of" function.

 
bool isSymbol (char x)
{
	 string SYMBOLS = "X ~`!@#$%^&*()_+-={}[]:\";'<>?,./|";
	 bool result = false;
	 int location = 0;
	 
	 location = SYMBOLS.find_first_of(x);
	 
	 if (location > 0)
		result = true;
	 
	 return result;
}
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote