Piyush Posted January 29, 2011 Share Posted January 29, 2011 I need a function 4 this..for eg if i input this string 'this i the {[first|last|third]} {[tym|time]} i m saying this to u..' it should return..an array containing these 6 strings... 1.)'this is the first tym i m saying this to u..' 2.)'this is the last tym i m saying this to u..' 3.)'this is the third tym i m saying this to u..' 4.)'this is the first time i m saying this to u..' 5.)'this is the last time i m saying this to u..' 6.)'this is the third time i m saying this to u..' Here {[ and ]} are special tags in which words are placed..seperated by | thx waiting 4 ur replies...:-) [font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font] Link to comment Share on other sites More sharing options...
Developers Jos Posted January 29, 2011 Developers Share Posted January 29, 2011 waiting 4 ur replies...:-)Understand that, like me, English isn't your mother tongue, but I am sure you can do better then this.So, try making normal sentences in stead of this turbo talk stuff and try to be more clear in your definition of your problem and your actual question. There is no question mark in your post at all.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Piyush Posted January 29, 2011 Author Share Posted January 29, 2011 Understand that, like me, English isn't your mother tongue, but I am sure you can do better then this.So, try making normal sentences in stead of this turbo talk stuff and try to be more clear in your definition of your problem and your actual question. There is no question mark in your post at all.Josare you telling me to not to use the shortcuts i have used in the post for e.g. 'your' instead of 'ur'?And i tried to explain my problem..as much as i could..i don't know wht to add to it..:-( [font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font] Link to comment Share on other sites More sharing options...
kylomas Posted January 29, 2011 Share Posted January 29, 2011 jos, "turbo talk", I like that. It perfectly describes this gobbledegook! kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 29, 2011 Share Posted January 29, 2011 @Piyush Show some code and ask a question and we might help you, but we're not writing your script for you. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Varian Posted February 1, 2011 Share Posted February 1, 2011 Seems interesting... Link to comment Share on other sites More sharing options...
ChrisL Posted February 1, 2011 Share Posted February 1, 2011 lk @ StringRegExp in t' help file ( you've got to know how to speak to these dudes ) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
LurchMan Posted February 1, 2011 Share Posted February 1, 2011 lk @ StringRegExp in t' help file ( you've got to know how to speak to these dudes )Reminds me of the movie Airplane! Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
kylomas Posted February 1, 2011 Share Posted February 1, 2011 reminds me of " A Clockwork Orange" Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Malkey Posted February 1, 2011 Share Posted February 1, 2011 (edited) Having proved to myself this method was possible, I might as well post it. #include <Array.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare Local $iCount = 0, $aResult[2000] Local $sStr = "This is the {[first|last|third]} {[occasion|time]} I'm saying this to {[you|him|her]}." _StringOptions($sStr, $aResult, $iCount) If $iCount > 0 Then ReDim $aResult[$iCount] _ArrayDisplay($aResult) EndIf Func _StringOptions($sStr, ByRef $aResult, ByRef $iCount) If StringRegExp($sStr, "\{\[(.+?)\]\}") Then ; Check if "{[" and "]}" is present in string. Local $aArray = StringRegExp($sStr, "\{\[(.+?)\]\}", 1) Local $aTemp = StringSplit($aArray[0], "|", 3) For $j = 0 To UBound($aTemp) - 1 Local $sTemp = StringReplace($sStr, "{[" & $aArray[0] & "]}", $aTemp[$j]) If StringRegExp($sTemp, "\{\[(.+?)\]\}") Then ; Check if "{[" and "]}" is present in string. _StringOptions($sTemp, $aResult, $iCount) ; Call function again if present. Else $aResult[$iCount] = $sTemp ; Results stored in ByRef array. $iCount += 1 EndIf Next EndIf Return EndFunc ;==>_StringOptions Edit: Added ByRef variables instead of using global variables. See Varian's next post for original post. Edited February 2, 2011 by Malkey Link to comment Share on other sites More sharing options...
Varian Posted February 1, 2011 Share Posted February 1, 2011 Having proved to myself this method was possible, I might as well post it. #include <Array.au3> Global $iCount = 0, $aResult[2000] Local $sStr = "This is the {[first|last|third]} {[occasion|time]} I'm saying this to {[you|him|her]}." _StringOptions($sStr) If $iCount > 0 Then ReDim $aResult[$iCount] _ArrayDisplay($aResult) EndIf Func _StringOptions($sStr) If StringRegExp($sStr, "\{\[(.+?)\]\}") Then ; Check if "{[" and "]}" is present in string. Local $aArray = StringRegExp($sStr, "\{\[(.+?)\]\}", 1) Local $aTemp = StringSplit($aArray[0], "|", 3) For $j = 0 To UBound($aTemp) - 1 $sTemp = StringReplace($sStr, "{[" & $aArray[0] & "]}", $aTemp[$j]) If StringRegExp($sTemp, "\{\[(.+?)\]\}") Then ; Check if "{[" and "]}" is present in string. _StringOptions($sTemp) ; Call function again if present. Else $aResult[$iCount] = $sTemp ; Results stored in global array. $iCount += 1 EndIf Next EndIf Return EndFunc ;==>_StringOptions Bravo! Link to comment Share on other sites More sharing options...
Piyush Posted February 2, 2011 Author Share Posted February 2, 2011 thx a lot guys for the solution....haven't tested your code..yet because i am in college....and i don't have a laptop... i also wrote a function during these days..in my notebook...during my classes.......to perform this task.... i will certainly have a look at this...again...thanks... [font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font] Link to comment Share on other sites More sharing options...
Piyush Posted February 6, 2011 Author Share Posted February 6, 2011 whoa! much better than what i thought...thx thx thx.....that works perfectly.... [font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font] 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