• Post Reply Bookmark Topic Watch Topic
  • New Topic

substring  RSS feed

 
Melinda Wilson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
How come I get a compile error for this script in my JSP?
This script is to place dashes in a phone number 1234567891.
<%
strHomephone.substring(0,3) + "-" + strHomephone.substring(2,5) + "-" + strHomephone.substring(5)
%>
Thank you.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this...
String newString = strHomephone.substring(0,3) + "-" + strHomephone.substring(3,6) + "-" + strHomephone.substring(6)
strHomePhone - newString
Bosun
 
Melinda Wilson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought I had deleted this post, it works. Thanks though!!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!