Jump to content

Change StringMid ()


edy
 Share

Recommended Posts

If you want $var = "tr"

$var = StringMid("string", 2, 2)
MsgBox(0, "2 chars extracted from position 3 are:", $var)

Does this help?

<{POST_SNAPBACK}>

"string" is for example a substring of another string and i don't know the start position but i find it with the function StringInStr ().

example:

$stringa = " uno due tre 11/3/04 quattro cinque"

$pos = StringInStr ( $stringa, "/" )

$var = StringMid("string", $pos-1, -2)

With the change of stringMid () $var must be "11"

Link to comment
Share on other sites

"string" is  for example a substring of another string  and i don't  know the start position but i  find it with the function StringInStr ().

example:

$stringa = " uno due tre  11/3/04 quattro cinque"

$pos = StringInStr ( $stringa, "/"  )

$var = StringMid($stringa, $pos-1, -2)

With the change of stringMid ()  $var  must  be  "11"

<{POST_SNAPBACK}>

Link to comment
Share on other sites

It would be a nice addition.

But you can do it by hand. I'll take your example:

$stringa = " uno due tre  11/3/04 quattro cinque"

$endpos = StringInStr ( $stringa, "/"  )
$startpos = $endpos - 2
$var = StringMid($stringa, $startpos, $endpos - $startpos)
MsgBox(0, "Test", "$var: " & $var)
Edited by SlimShady
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...