Emiel Wieldraaijer Posted November 15, 2008 Posted November 15, 2008 (edited) Hi All, does someone know how to easily replace multiple spaces with one space.. For example $String = "I don't like spaces" Should be $StringNew = "I don't like spaces" Thnx Emiel Edited November 15, 2008 by Emiel Wieldraaijer Best regards,Emiel Wieldraaijer
martin Posted November 15, 2008 Posted November 15, 2008 Hi All,does someone know how to easily replace multiple spaces with one space..For example $String = "I don't like spaces"Should be $StringNew = "I don't like spaces"ThnxEmiel$StringNew = StringStripWS($String,4) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Emiel Wieldraaijer Posted November 15, 2008 Author Posted November 15, 2008 @Martin Thanks... i feel stupid Best regards,Emiel Wieldraaijer
Madza91 Posted November 15, 2008 Posted November 15, 2008 Or you can do it with StringReplace($string, " ", "") [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
GEOSoft Posted November 15, 2008 Posted November 15, 2008 Or you can do it with StringReplace($string, " ", "")That will remove all spaces and not just the extra ones. 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!"
Madza91 Posted November 15, 2008 Posted November 15, 2008 (edited) Oh, i didn't see whole question Btw, just add your number of spaces what you need to replace ^^ StringReplace($string, " ", "") Edited November 15, 2008 by n3nE [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
GEOSoft Posted November 15, 2008 Posted November 15, 2008 Oh, i didn't see whole question Btw, just add your number of spaces what you need to replace ^^ StringReplace($string, " ", "") What happens when there may be one or more extra spaces? The correct answer has already been given to the problem. To do anything with StringReplace you would have to do something like While StringInStr($string, " ") $sString = StringReplace($string, " ", " ") Wend Why would you want to use a slow method like that when $string = StringStripWS($string, 4) will do it for you? 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!"
Madza91 Posted November 15, 2008 Posted November 15, 2008 U just said another solution [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
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