Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by mannevenu26
at 2024-07-21 05:47:20
Point:500 Replies:6 POST_ID:829054USER_ID:11958
Topic:
JavaScript;;
Hi,
I have string
welcome?page#isexperts
in above string i want to find out '?'
How to find '?' is present in above string.if present how to identify index of that '?'.
can u plz give me javascript code for this
I have string
welcome?page#isexperts
in above string i want to find out '?'
How to find '?' is present in above string.if present how to identify index of that '?'.
can u plz give me javascript code for this
Expert: duncanb7 replied at 2024-07-21 07:45:06
Thanks for your points
Have a nice day
Duncan
Have a nice day
Duncan
Accepted Solution
Expert: duncanb7 replied at 2024-07-21 06:05:43
250 points EXCELLENT
You can find out "? exist or not by RegExp pattern, take a look the follow code for reference only, and seach the position as the last post mentioned
Duncan
Duncan
<html><meta http-equiv="Content-Type" content="text/html; charset=Big5"><head><title>Title</title><style></style><script type="text/javascript">function init(){str="welcome?page#isexperts";var check=new RegExp ("[?]");if(check.test(str)==true) alert(str.search('\?'));elsealert( "No such character");}</script><script type="text/javascript"></script></head><body onload="javascript:init()" ></body></html> 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:
Expert: Radek Baranowski replied at 2024-07-21 06:04:07
btw I edited my initial answer, so please refresh in browser to see the suggested solution,
it's:
var str = "welcome?page#isexperts";
var n = str.search("\?");
n contains the position of your searched character in the string (accounted for the fact that first character has index=0)
it's:
var str = "welcome?page#isexperts";
var n = str.search("\?");
n contains the position of your searched character in the string (accounted for the fact that first character has index=0)
Expert: Radek Baranowski replied at 2024-07-21 06:03:27
you mean " " ??
the direction is quite important here, I'm talking backslash
the direction is quite important here, I'm talking backslash
Author: mannevenu26 replied at 2024-07-21 06:01:25
getting error Microsoft JScript runtime error: Unexpected quantifier.
Both i triewd with / and without /
Both i triewd with / and without /
Assisted Solution
Expert: Radek Baranowski replied at 2024-07-21 05:51:37
250 points EXCELLENT
http://www.w3schools.com/jsref/jsref_search.asp
var str = "welcome?page#isexperts";
var n = str.search("\?");
n contains the position of your searched character in the string (accounted for the fact that first character has index=0)
var str = "welcome?page#isexperts";
var n = str.search("\?");
n contains the position of your searched character in the string (accounted for the fact that first character has index=0)