Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

get substring of an string

Posted on 2014-04-02
10
Medium Priority
?
277 Views
Last Modified: 2014-04-19
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
Comment
Question by:rafaelrgl
7 Comments
 
LVL 29

Expert Comment

by:sammySeltzer
ID: 39973465
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
 
LVL 37

Expert Comment

by:Kimputer
ID: 39973536
Is it always a number? Fixed length? Always enclosed by the open bracket ( and comma?
0
 
LVL 1

Author Comment

by:rafaelrgl
ID: 39973725
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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 20

Accepted Solution

by:
n2fc earned 2000 total points
ID: 39973776
<!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
 
LVL 2

Expert Comment

by:Rob Jurd (eenookami)
ID: 40009394
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
 
LVL 20

Expert Comment

by:n2fc
ID: 40009392
Did he even TRY my solution?   It works!
0
 
LVL 20

Expert Comment

by:n2fc
ID: 40009395
Did he even TRY my solution?   It works!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question