How can I remove double quote and extra space from string in php?
you can use trim function to remove both sided extra characters
$str = '"32134131 "';
trim($str, "\" ");
In this code sample above, the $str
is passed through the trim function which looks for and removes all "
and characters.
Remove extra escaped double quotes from list of Clojure strings
Since quoted strings are the edn format for strings you could use clojure.edn/read-string to convert your strings removing the quote delimiters (assuming all of your lines are delimited by quotes):
> (with-open [rdr (clojure.java.io/reader "matches.txt")]
(doall (map clojure.edn/read-string (line-seq rdr))))
("key1" "key2" "key3")
clojure.core/read-string could be used as well, but note the warning that
... read-string can execute code (controlled by read-eval), and as
such should be used only with trusted sources.
Remove quotes in javascript
It's weird. Your solution should work.
Well, try this:
var value = "fetchedValue";
value = value.slice(1, -1);
How to remove double quotes in variable Javascript
sup.replace(/["']/g, "");
is going right way but you're just needing to store in a variable like @destryo has answered.
sup = sup.replace(/["']/g, "");
But I think you're needing to convert it to a number. If so, you may use parseInt:
parseInt(sup, 10);
remove double quotes from field
I believe you should focus on how to correctly split the line/row into tokens instead of removing unwanted double-quote characters from the line.
The block delimiter has form of ","
or ", "
thus the regex to split the line would be
(?<="),\s*(?=")
See DEMO with regex explanation
Want to remove the double quotes from the strings
You need to assign it back to rowString
:
rowString = rowString.Replace('"', ' ').Trim();
Strings are immutable.
row.String.Replace(...)
will return you a string, since you are not assigning it anything it will get discarded. It will not change the original rowString
object.
You may use String.Empty
or ""
to replace double quotes with an empty string, instead of single space ' '
. So your statement should be:
rowString = rowString.Replace("\"", string.Empty).Trim();
(Remember to pass double quote as a string "\""
, since the method overload with string.Empty will require both the parameters to be of type string).
You may get rid of Trim()
at the end, if you were trying to remove spaces adding during string.Replace
at the beginning or end of the string.
Related Topics
Seahorse::Client::Networkingerror Amazon S3 File Upload with Rails
Sublime Text 2 Doesn't Save Built SASS File
How to Make an Infowindow Automatically Display as Open with Google-Maps-For-Rails
How to Overwrite the '{ }' Object
How to Return the Number of Devise Users Currently Logged In
What Is the Fully Qualified Name of a Model in Ruby on Rails
Loaderror - Cannot Open Shared Object File - File Is Present, But It Says No Such File
Why Sinatra Request Takes Em Thread
Rails - How to Add Contacts to Sendgrid Marketing Campaigns via API
My Classes Can't Use Shoes Methods Like Para
Check If String Is Repetition of an Unknown Substring
Disabling Flash Message Without Disabling Cache on Click on Back Button in Rails
Ruby Executable Won't Start on Win10 and Win7
Selenium Webdriver Take Screenshot of Viewport Only
How to Condense Summable Metrics to a Unique Identifier in a Ruby Table