How to remove double quotes from a variable in a batch file? - windows-xp

var may be double quoted:
set var="Very long text"
or without quotes:
set var=Some_Text
I would like to get the unquoted text, i.e. Very long text in the first case and Some_Text in the second one.
How could I remove the double quotes, if exist ?

Have you tried this method?
See also: http://ss64.com/nt/syntax-esc.html

Related

Renaming columns with ' in pyspark

How to rename column "RANDY'S" to 'RANDYS' in pyspark?
I tried below code and its not working
test_rename_df=df.withColumnRenamed('"RANDY''S"','RANDYS')
Note that original column name has double quotes around it
enter image description here
You're adding too many quotes around the original column name. Try this:
test_rename_df = df.withColumnRenamed("RANDY\'S", "RANDYS")
Side-note
When you call df.columns, the column RANDY'S is surrounded by double quotes instead of single quotes to avoid confusion.
If your column had the name RANDY"S, df.columns would instead use single quotes around the column name (see screenshot below):

Putting Powershell variable in double quotes shows Object type instead of value

I see this problem in several area, but here is an example
I read an xml document like this and print out a value
[xml]$pom = get-content -path pom.xml
PS C:\> $pom.project.artifactId
nexus-peter-test-service
However, if I put the value in double quotes, I get this
"$pom.project.artifactId"
System.Xml.XmlDocument.project.artifactId
I need the value in double quotes because it's part of a long string. In my case, a url. So I'm using it like this:
"/$pom.project.artifactId/"
Why does Powershell change the meaning of the variable when in it's double quotes? And how can I fix this?
The problem is that the interpolation stops at the period. It interpolates "$pom" - which stringifies as the class name - followed by the literal string ".project.artifactId".
To interpolate anything more complex than a simple variable name, you need to wrap $(...) around the expression:
"$($pom.project.artifactId)"

LotusScript - How to escape double quotes in the SELECT statement?

I have a multiple documents which are containing the field named organization.
Almost every second document contains double quotes in this field, for example: Medical Center "James Goodwin Corp." e.t.c
I have a search query with the name of some organization, which also contains quotes and trying to use this name in the search query to find all needed documents.
I have tryed many variants and each time I am getting the query syntax error about double quotes.
Can you please give some small example or some advise how to escape double quotes in the SELECT statement?
Thank you!
Update:
Yes, I am using Replace function like this:
searchValue = Replace(docByUi.search(0),{"},{|"|})
to change this double quotes to |"|.
And I am getting an error in my select query
Or maybe I am wrong in something?
Update #2:
My query looks like this:
query = {Form="Person" & #Contains(} & docByUi.fields(0) & {;"} & searchValue & {")}
I meaned that I am already using {} to create a part-to-part query.
You can use curly braces {} in your search statement. You don't need to escape double quotes inside braces.
Here is example of your search query:
Form = "Person" & #Contains(Level0; {Filia "Department of Y"})
In your lotus script you can use | symbol to make your string:
query$ = |Form="Person" & #Contains(| & docByUi.fields(0) & |; {| & searchValue & |})|
Instead of using double quotes, use the pipe character:
Select #Contains(Organization; |"|);
Is that what you are trying to do?

How can I put single quotes in a string?

I'm facing a problem with string in MATLAB the default string is C:\Users\Root\Downloads\Path. I want to make this string with single quotes inside it like this 'C:\Users\Root\Downloads\Path\'. I try many times to escape the string with backslash like other programming languages but MATLAB didn't doing this i don't know how to fix this problem.
Code:
clear all
clc
s='C:\Users\Root\Downloads\Path';
str=fprintf('%s',s);
The trick is to use two quotes instead of one:
s='''C:\Users\Root\Downloads\Path''';
str=fprintf('%s',s)
'C:\Users\Root\Downloads\Path'
str =
30
Note that str will be the number 30, since fprintf returns the number of characters it prints, not the string itself! If you just want the string, then the first line is enough.
disp(s)
'C:\Users\Root\Downloads\Path'
Note that there is no data type "String" in MATLAB. You have an array of characters.

Using camelCased columns in a postgresql where clause

I have a table with camelCased column names (which I now deeply regret). If I use double quotation marks around the column names as part of the SELECT clause, they work fine, e.g. SELECT "myCamelCasedColumn" FROM the_table;. If, however, I try doing the same in the WHERE clause, then I get an error.
For example, SELECT * FROM the_table WHERE "myCamelCasedColumn" = "hello"; gives me the error column "hello" does not exist.
How can I get around this? If I don't surround the column in double quotation marks then it will just complain that column mycamelcasedcolumn does not exist.
In SQL string literals are enclosed in single quotes, not double quotes.
SELECT *
FROM the_table
WHERE "myCamelCasedColumn" = 'hello';
See the manual for details:
http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
The manual also explains why "myCamelCasedColumn" is something different in SQL than myCamelCasedColumn
In general you should stay away from quoted identifiers. They are much more trouble than they are worth it. If you never use double quotes everything is a lot easier.
The problem is you use double quote for strin literal "hello". Should be 'hello'. Double quotes is reserved for identifiers.