get substring of an string

hi i have this string below

dim test as string = "javascript: test2(4622,4623)"

i want to get the first number inside the function test2, so the result would be 4622.

how can i accomplish this.
LVL 1
rafaelrglAsked:
Who is Participating?
 
n2fcConnect With a Mentor Commented:
<!DOCTYPE html>
<html>
<body>
<script>
var test = "javascript: test2(4622,4623)";


i=test.indexOf("(");
j=test.indexOf(",");


var measureit = test.substring(i+1,j);
document.write(measureit);

</script>
</body>
</html>

Open in new window

0
 
sammySeltzerCommented:
Javascript solution:

<!DOCTYPE html>
<html>
<body>
<script>
var test = "4622,4623";
var measureit = test.substring(0, 4);
document.write(measureit);
</script>
</body>
</html>

Open in new window


vb.net version
Dim test As String = "4622,4623"
Response.Write(test.Substring(0, 4))

Open in new window

0
 
KimputerCommented:
Is it always a number? Fixed length? Always enclosed by the open bracket ( and comma?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
rafaelrglAuthor Commented:
is always an number but it~s not fixed size, can be 4 digits, can be 8 digits, but always have the comma after the first number and have the ( before start the number.
0
 
Rob JurdEE Community AdvisorCommented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.  No response from anyone involved and doesn't appear to be a solution here.
0
 
n2fcCommented:
Did he even TRY my solution?   It works!
0
 
n2fcCommented:
Did he even TRY my solution?   It works!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.