Development, Software, Hardware, System, Network, API, WebService, Programmation and co..
Monday, September 19, 2016
Thursday, September 15, 2016
Friday, September 9, 2016
Symfony cache warmup
php app/console cache:warmup --env=prod --no-debugThursday, August 25, 2016
SQL method to replace repeating blanks with single blanks
Link : http://stackoverflow.com/questions/2182877/sql-method-to-replace-repeating-blanks-with-single-blanks
Here is a simple set based way that will collapse multiple spaces into a single space by applying three replaces.
Your Update statement can now be set based:
Use an appropriate Where clause to limit the Update to only the rows that have you need to update or maybe have double spaces.
e.g.
I have found an external write up on this method: REPLACE Multiple Spaces with One
|
Check if string contains only letters in javascript
Check this out : http://stackoverflow.com/questions/23476532/check-if-string-contains-only-letters-in-javascript
With
/^[a-zA-Z]/ you only check the first character:^: Assert postion at the beginning of the string[a-zA-Z]: match a single character present in the list below:a-z: A character in the range between "a" and "z"A-Z: A character in the range between "A" and "Z"
If you want to check if all characters are letters, use this instead:
/^[a-zA-Z]+$/.test(str);
^: Assert postion at the beginning of the string[a-zA-Z]: match a single character present in the list below:+: Between one and unlimited times, as many as possible, giving back as needed (greedy)a-z: A character in the range between "a" and "z"A-Z: A character in the range between "A" and "Z"
$: Assert postion at the end of the string (or before the line break at the end of the string, if any)
Or, using the case-insensitive flag
i, you could simplify it to/^[a-z]+$/i.test(str);
Or, since you only want to
test, and not match, you could check for the opposite, and negate it:!/[^a-z]/i.test(str);
Subscribe to:
Posts (Atom)