Jump to content
  • 0
botka4aet

String -> Number

Question

So i have strings "Test1", "Test2", "Test3", "Test4" and so on.

Any way to get integer from it? 1,2,3,4

Without

if (a = "Test1") b := 1;
else if (......

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 1

there's a few different ways:
 

.@num = charat("Test3", 4);
sscanf("Test3", "Test%d", .@num);
.@num = substr("Test3", 4, 4);
pcre_match("Test3", "^[^0-9]*([0-9]+)$");
.@num = $@regexmatch$[1];

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.