asgarcymed 0 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... Share this post Link to post Share on other sites
BrettF 28 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.$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! Share this post Link to post Share on other sites
asgarcymed 0 Posted October 6, 2007 Thank you! MLMK - my blogging craziness... Share this post Link to post Share on other sites
PsaltyDS 42 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 Share this post Link to post Share on other sites
asgarcymed 0 Posted October 6, 2007 Very interesting! I am delighted with AutoIt!! MLMK - my blogging craziness... Share this post Link to post Share on other sites