Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-13-2007, 08:39 PM
Member
 
Join Date: Nov 2007
Posts: 45
sireesha is on a distinguished road
String operations..
Hi friends,
can u please tell me..
how to verify the presence of a particular sequence of characters in a string ?
is there any method for this ?
thankq
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-13-2007, 09:39 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Check this tutorial:

Java String
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-14-2007, 01:28 AM
Member
 
Join Date: Nov 2007
Posts: 45
sireesha is on a distinguished road
thankq,
i learned more about string from that tutorial.
but i couldn't get answer to my question from that.
i want to varify the presence of particular sequence of characters in a string.
(for example we have to check the presence of "java" in the string "string operations in java ".)
such method have to return boolean type date depends on the presence of string.
is there any such method ?
please tell me...
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-14-2007, 03:00 AM
Member
 
Join Date: Nov 2007
Posts: 11
rajiv_bang is on a distinguished road
A small example to get you started.


Code:
import java.util.*; public class FindString { public static void main(String args[]) { String s1 = "String operations in java"; if(s1.indexOf("java")>-1) System.out.println("Found"); else System.out.println("Not found"); } }
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 12-14-2007, 03:04 AM
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
Code:
String s = "foobar"; if (s.contains("bar")) // it conains
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stack push/pop/peek operations Java Tip Java Tips 0 01-29-2008 10:03 AM
Uses unchecked or unsafe operations message Robbinz New To Java 2 12-06-2007 11:56 PM
Using java.util.Scanner to search for a String in a String Java Tip Java Tips 0 11-20-2007 05:59 PM
Help with insertName(String name) and deleteName(String name) trill New To Java 1 08-07-2007 08:29 AM
I can't seem to pass the value of a string variable into a string array mathias Java Applets 1 08-03-2007 11:52 AM


All times are GMT +3. The time now is 05:37 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org