Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

substring problem

 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

From the following output:

Channel Location State Application(Data)
SIP/NBE-09749568 (None) Down (None)
1 active channel
0 active calls



I need to take SIP/NBE-09749568.How can i split this.I tried using substring,but i am unable to get what i need.please assist me to do this.

Thanks.
 
Ranjana Patil
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try with str.substring(40,56) it should work fine. Does the source String includes new lines?
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.It is working fine by using


if(channel.startsWith("SIP")==true)
{
String channel2=channel.substring(0,16);
}


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic