Forums Register Login

String question!

+Pie Number of slices to send: Send
How can I find an occurrence of the first string in the second one?
Example: How can I find the first occurrence of the string �Post New Topic� in the source code of this page?
+Pie Number of slices to send: Send
I am not sure if i understand your example, but two check the occurence of one string in another you can use indexOf method.
here is what the API says:

Returns the index within this string of the first occurrence of the specified substring. The integer returned is the smallest value k such that: this.startsWith(str, k) is true.


HTH
+Pie Number of slices to send: Send
 

Originally posted by zoster gibrilian:
How can I find an occurrence of the first string in the second one?
Example: How can I find the first occurrence of the string �Post New Topic� in the source code of this page?


try the String method ( jdk 1.4 ) - indexOf( String )
Jamie
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 762 times.
Similar Threads
Finding exact element in a javascript variable
How to find a word in a text file? (2)
string to int
Finding string occurrences in a string
find particular characters within a String ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:47:28.