asgarcymed Posted October 6, 2007 Posted October 6, 2007 I have a $string_variable = "XToday is a new dayX" And I want to remove the first AND the last letters (both "X"), so my $string_variable will be meaningful ("Today is a new day"). How to do $trimmed = {StringTrimLeft ($string_variable, 1) AND StringTrimRight ($string_variable, 1)} ? Thanks. Best regards. MLMK - my blogging craziness...
BrettF Posted October 6, 2007 Posted October 6, 2007 asgarcymed said: I have a $string_variable = "XToday is a new dayX" And I want to remove the first AND the last letters (both "X"), so my $string_variable will be meaningful ("Today is a new day"). How to do $trimmed = {StringTrimLeft ($string_variable, 1) AND StringTrimRight ($string_variable, 1)} ? Thanks. Best regards.$string_variable = "XToday is a new dayX" $trimmed = StringTrimLeft ($string_variable, 1) $trimmed = StringTrimRight ($trimmed, 1) MsgBox (0, "TRIMMED", "Trimed from '" &$string_variable & "' to '"&$trimmed&"'") Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
asgarcymed Posted October 6, 2007 Author Posted October 6, 2007 Thank you! MLMK - my blogging craziness...
PsaltyDS Posted October 6, 2007 Posted October 6, 2007 Just for academic interest, you can "nest" functions in AutoIt, which means the input parameter to a function can be a call to another function. So you might start with Bert's working demo: $string_variable = "XToday is a new dayX" $trimmed = StringTrimLeft ($string_variable, 1) $trimmed = StringTrimRight ($trimmed, 1) MsgBox (0, "TRIMMED", "Trimed from '" &$string_variable & "' to '"&$trimmed&"'") ...and combine the StringTrim functions: $string_variable = "XToday is a new dayX" $trimmed = StringTrimRight (StringTrimLeft ($string_variable, 1), 1) MsgBox (0, "TRIMMED", "Trimed from '" &$string_variable & "' to '"&$trimmed&"'") ...and combine again into the MsgBox (if you don't need the intermediate $trimmed variable for later use): $string_variable = "XToday is a new dayX" MsgBox (0, "TRIMMED", "Trimed from '" & $string_variable & "' to '" & StringTrimRight (StringTrimLeft ($string_variable, 1), 1) &"'") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
asgarcymed Posted October 6, 2007 Author Posted October 6, 2007 Very interesting! I am delighted with AutoIt!! MLMK - my blogging craziness...
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