erezlevi Posted February 5, 2008 Posted February 5, 2008 (edited) I have the following code that I need to exctract everything between and H. (like [13;1H), but the 13;1 the 13 shows the line and the 1 is the position of where to put the string in a new string: for example: if this is my string: "[13;1H 7:00- 8:00 [13;13H 1[13;19H 0:10[13;26H 3" then, the final string should be: (look at the picture please). now, my problem is that I can't get it into a new string $s why? $m="[13;1H 7:00- 8:00 [13;13H 1[13;19H 0:10[13;26H 3" $s="" MsgBox (0,"",$m); before change! $p1 = StringInStr($m, Chr(27), 1) $p2 = StringInStr($m, "H", 1,1) MsgBox (0,"",$p2) $p3 = ($p2 - $p1) + 1 $n = StringMid($m, $p1, $p3) MsgBox (0,"this is $n:",$n) $nn1=StringSplit ($n,";",1) $nn2=$nn1[2] $nn3=StringTrimRight ($nn2,1) MsgBox (0,"this is $nn3:",$nn3) ; position of where to put the second TRIM. ;$t = StringReplace($m, $n, "") ;MsgBox (0,"$t:",$t) $p3=StringInStr ($m,"H",1,1) ; for string between H and second like: 7:00- 8:00. $p4=StringInStr ($m, Chr(27),1,2) $p3=$p3+1 MsgBox (0,"",$p4) $p5= ($p4-$p3) $n1=StringMid ($m,$p3,$p5) MsgBox (0,"this is $n1:",$n1) $s=_StringInsert ($m,$n1,$nn3) ; this part not working! MsgBox (0,"this is $s",$s) Edited February 5, 2008 by erezlevi
erezlevi Posted February 5, 2008 Author Posted February 5, 2008 ok this fixes it: $s=_StringInsert ($s,$n1,Number ($nn3)).
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now