some1 Posted April 11, 2008 Share Posted April 11, 2008 If $variableA = "heya.bye", how do I make $variableB just "bye", the part after the dot??? I have tried like this (I know that it is stupid, but it may give you an idea to what I'm trying to do...: $variableA = "heya.bye" $variableB = $variableA - "heya." Link to comment Share on other sites More sharing options...
Zedna Posted April 11, 2008 Share Posted April 11, 2008 $variableA = "heya.bye" $variableB = StringSplit($variableA,".") $variableB = $variableB[2] Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
GEOSoft Posted April 11, 2008 Share Posted April 11, 2008 If $variableA = "heya.bye", how do I make $variableB just "bye", the part after the dot??? I have tried like this (I know that it is stupid, but it may give you an idea to what I'm trying to do...: $variableA = "heya.bye" $variableB = $variableA - "heya."$variableA = "heya.bye" $varB = StringMid($variableA, StringInStr($variableA, ".") +1) It can also be done with RegEx but it's better to learn the basic AutoIt functions before moving on to the more advanced. Besides, no matter what programming language forum you go to, you will see what people think (in general) about RegEx. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
some1 Posted April 11, 2008 Author Share Posted April 11, 2008 yay, thx for the quick reply ^^ gonna try out now Link to comment Share on other sites More sharing options...
GEOSoft Posted April 11, 2008 Share Posted April 11, 2008 (edited) Well you have two methods to plaay with. Zedna has provided the easiest and mine is an alternate. I should have added that I would change Zednas code just a wee bit to $variableB = $variableB[Ubound($variableA) -1] The reason is that it will allow for more than one period in the origional expression as in "heya.there.bye" Edited April 11, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
some1 Posted April 11, 2008 Author Share Posted April 11, 2008 (edited) yesssss, thx guys ^^ it worked!! EDIT: $variableA = "heya.bye" $variableB = StringSplit($variableA,".") $variableB = $variableB[2] Well you have two methods to plaay with. Zedna has provided the easiest and mine is an alternate. I should have added that I would change Zednas code just a wee bit to $variableB = $variableB[Ubound($variableA) -1] The reason is that it will allow for more than one period in the origional expression as in But it allready worked with more seperators... or is that not what you are meaning? Edited April 11, 2008 by some1 Link to comment Share on other sites More sharing options...
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