How can I configure Entity Framework to automatically trim values retrieved for specific columns mapped to char(N) fields?

Rowan Miller (program manager for Entity Framework at Microsoft) recently posted a good solution to this which uses Interceptors. Admittedly this is only valid in EF 6.1+. His post is about trailing strings in joins, but basically, the solution as applied neatly removes trailing strings from all of the string properties in your models, automatically, … Read more

How do I remove trailing whitespace from a QString?

QString has two methods related to trimming whitespace: QString QString::trimmed() const Returns a string that has whitespace removed from the start and the end. QString QString::simplified() const Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space. If you … Read more

How to remove trailing and leading whitespace for user-provided input in a batch file?

The solution below works very well for me. Only 4 lines and works with most (all?) characters. Solution: :Trim SetLocal EnableDelayedExpansion set Params=%* for /f “tokens=1*” %%a in (“!Params!”) do EndLocal & set %1=%%b exit /b Test: @echo off call :Test1 & call :Test2 & call :Test3 & exit /b :Trim SetLocal EnableDelayedExpansion set Params=%* … Read more

Trim Whitespaces (New Line and Tab space) in a String in Oracle

If you have Oracle 10g, REGEXP_REPLACE is pretty flexible. Using the following string as a test: chr(9) || ‘Q qwer’ || chr(9) || chr(10) || chr(13) || ‘qwerqwer qwerty’ || chr(9) || chr(10) || chr(13) The [[:space:]] will remove all whitespace, and the ([[:cntrl:]])|(^\t) regexp will remove non-printing characters and tabs. select tester, regexp_replace(tester, ‘(^[[:space:]]+)|([[:space:]]+$)’,null) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)