![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | escape character question - hopefully an easy question When a string with an escape character is enclosed in double quotes ( ie. "k`[][][]") , the escape character is removed. With the given example, the string becomes k[][][]. However, if it is enclosed in single quotes, it retains the little 'tick'. I'm working with ADO recordsets and fields of data from access databases which are returned in the double-quote string format. Is there anyway I can retain the 'tick' in this situation? I've tried "k`[][][]" -replace('`','``'), but this does not seem to work. Is there a simple solution? |
My System Specs![]() |
| | #2 (permalink) |
| | RE: escape character question - hopefully an easy question I just tried this and it worked PS> "k`[][][]" k[][][] PS> "k``[][][]" k`[][][] I don't think the replace will work as the single ` is lost as you build the string -- Richard Siddaway All scripts are supplied "as is" and with no warranty PowerShell MVP Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Cookiecutter" wrote: Quote: > When a string with an escape character is enclosed in double quotes ( ie. > "k`[][][]") , the escape character is removed. With the given example, the > string becomes k[][][]. However, if it is enclosed in single quotes, it > retains the little 'tick'. > > I'm working with ADO recordsets and fields of data from access databases > which are returned in the double-quote string format. Is there anyway I can > retain the 'tick' in this situation? I've tried "k`[][][]" > -replace('`','``'), but this does not seem to work. Is there a simple > solution? |
My System Specs![]() |
| | #3 (permalink) |
| | Re: escape character question - hopefully an easy question On Jan 28, 7:36*pm, Cookiecutter <Cookiecut...@xxxxxx> wrote: Quote: > When a string with an escape character is enclosed in double quotes ( ie. > "k`[][][]") , the escape character is removed. *With the given example,the > string becomes *k[][][]. *However, if it is enclosed in single quotes, it > retains the little 'tick'. * > > I'm working with ADO recordsets and fields of data from access databases > which are returned in the double-quote string format. *Is there anyway I can > retain the 'tick' in this situation? *I've tried "k`[][][]" > -replace('`','``'), but this does not seem to work. *Is there a simple > solution? IOW it was never really in the string to begin with. But if you have a string that contains the character then nothing should remove it without you taking some explicit action. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Re: exchange shell escape character | PowerShell | |||
| Escape character question | PowerShell | |||
| How can I escape a slash character in item name? | PowerShell | |||
| howto? escape the comment character | PowerShell | |||
| Bug in escape character / variable expansion? | PowerShell | |||