trying to see if the last character is a '>'......any suggestions

I already know how to check for the character


heres what I got

if (userData.getName().charAt(0)!='<' ) {


thank

alright...let me check that out..I'll be back to let u know

getting illegal start of expression and ';' expected...Im sure it's something small..or I set it up wrong....take a look

<div id="contactInfo">
  <%
	if (userData.getName().charAt(0)!='<') || (userData.getName().charAt(userData.getName().length()-1)!='>' ) {
  %>    

	<span> <%=userData.getName()%> &#8226;</span>
<%}

%>

Check your parenthesis on the if() statement.

ok I opened up the if:

<div id="contactInfo">
  <%
	if (userData.getName().charAt(0)!='<' || userData.getName().charAt(userData.getName().length()-1)!='>' ) {
  %>    

	<span> <%=userData.getName()%> &#8226;</span>

if I put "<sample" for the name...nuthing shows up

but if I put"sample>"..it still displays the string

I would think you'd want an && condition there, not an ||.

if (!userData.getName().startsWith("<") && !userData.getName().endsWith(">") )

This looks to me like the beginning of a html/xml parser of some kind. If I'm wrong well, there ya go.

If I'm not then perhaps you should start looking into regular expressions. As they will help you in the long run.

This article has been dead for over six months. Start a new discussion instead.