Hi and sorry for my english...

Thank you my friends for your advice...

i had check your code and finally the function works...

bellow is the code... free for use ... free for all...

this is a function that take a STRING ARRAY and check for one string for examle l_array_str[1]
for invalid characters...

if the character that checked there is inside the cases '...' , continue to next character, and
if goes to end ... return success

if the character that checked there isn't inside the case '...' , terminate the while loop and
return error...

Code:
//------------------------------------------------------------------------------------------
//------------------------------ function f_check_for_invalid_chars
function f_check_for_invalid_chars(STRING** l_array_str)
{
	int l_i = 0;
	int l_temp_1_int;
	int l_temp_2_int;
	
	STRING* l_temp_1_str = " ";
	char l_chr = ' ';
	
	bool l_while_stop_bool;
	
	l_temp_1_str = l_array_str[1];
	l_temp_2_int = str_len(l_temp_1_str);
	
	l_i = 1;
	l_while_stop_bool = false;
	
	while ( (l_i <= l_temp_2_int ) && (l_while_stop_bool == false) )
	{
		l_temp_1_int = 0;
		l_chr = str_getchr(l_temp_1_str, l_i);
		switch( l_chr )
		{
			case 'Q':
			case 'W':
			case 'E':
			case 'R':
			case 'T':
			case 'Y':
			case 'U':
			case 'I':
			case 'O':
			case 'P':
				
			case 'A':
			case 'S':
			case 'D':
			case 'F':
			case 'G':
			case 'H':
			case 'J':
			case 'K':
			case 'L':
				
			case 'Z':
			case 'X':
			case 'C':
			case 'V':
			case 'B':
			case 'N':
			case 'M':
			
			case 'q':
			case 'w':
			case 'e':
			case 'r':
			case 't':
			case 'y':
			case 'u':
			case 'i':
			case 'o':
			case 'p':
			
			case 'a':
			case 's':
			case 'd':
			case 'f':
			case 'g':
			case 'h':
			case 'j':
			case 'k':
			case 'l':
			
			case 'z':
			case 'x':
			case 'c':
			case 'v':
			case 'b':
			case 'n':
			case 'm':

			case '1':
			case '2':
			case '3':
			case '4':
			case '5':
			case '6':
			case '7':
			case '8':
			case '9':
			case '0':
			{
				l_temp_1_int = 1;
			}
			break;
		}
		if (l_temp_1_int == 1)
		{
			l_i++;
		}
		else
		{
			l_while_stop_bool = true;
		}
		
	}
	
	if (l_while_stop_bool == true)
	{
		printf("Invalid Name");
		return -2;
	}
	else
	{
		printf("Name was saved");
		return 1;
	}
}



txk you all... and for all...
Best Regards.
Dimitris.

Last edited by NeoJT; 04/29/13 07:38.