Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Re: How to dealing with single quote ( ' )


Message #1 by "Patrick Lane-Spollen" <patrick@b...> on Sat, 17 Feb 2001 14:18:22
Thanks Tom,
Your code for dealing with 's works perfectly:

String iRname = request.getParameter("inpRname");

/*Handling apostrophies in a string for input into Access Database*/

StringBuffer b = new StringBuffer(); 

for (int i=0;i<iRname.length();i++)
	{
	char c = iRname.charAt(i);	
	if ((c=='\'')||(c=='\"')||(c=='\\')) 
		{
		b.append('\'');
		}
	b.append(c);
	}
iRname=b.toString();


Patrick

  Return to Index