[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 280
  • Last Modified:

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.
0
rafaelrgl
Asked:
rafaelrgl
1 Solution
 
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
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
n2fcCommented:
<!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
 
Rob Jurd (eenookami)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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now