String.prototype.NormaliseUrl = function () {
var url = this;
var preserveNormalForm = /[,_`;\':-]+/gi
url = url.replace(preserveNormalForm, ' ');
// strip accents
url = stripVowelAccent(url);
//remove all special chars
url = url.replace(/[^a-z|^0-9|^-|\s]/gi, '').trim();
//replace spaces with a -
u...
Hi,
I have an array with words like
$arr = array("go", "walk", ...)
I would like to replace these words with links f they are matched in sentences. But it should be only if they match exactly (for example "walk" should match "Walk" or "walk!" but not also "walking")
And the replacement should be a simple link like: < a href='#walk' >...
How do I stick HTML formatting into a String object in C#?
Here's what I have:
c.DepartmentAbbr.ToString() + " - (" + c.DepartmentName.ToString() + ")"
where c.DepartmentAbbr.ToString() and c.DepartmentName.ToString() are both fields being selected from a data context using LINQ.
Here's what I essentially want:
"<b>" + c.Department...
I currently have a string which contains the characters A, B and C for example the string looks like
"A some other random stuff B C"
the other random stuff doesn't contain A, B or C I want to replace the A, B & C with 'A', 'B' and 'C' respectively what's the best way to do that currently I'm doing:
String.replace("A", "'A'").replace...
Hi, I am trying to remove text that is within parentheses (along with the parentheses themselves) but am having trouble with the scenario where there are parentheses within parentheses. This is the method I am using (in Ruby):
sentence.gsub(/\(.*?\)/, "")
and that works fine until I have a sentence such as:
"This is (a test (strin...
I have multiple strings that are in the following format:
12/18/2009 02:08:26 Admitted Doe, John (Card #111) at South Lobby [In]
From these string I need to get out the date, time, first and last name of the person, and the card number. The word admitted can be omitted and anything following the final digit of the card number can be ign...
What is the method for converting strings in Java between upper and lower case?
...
Hey, I am using a reg expression to remove parentheses and the content between them from a ruby string. The problem is that this sometimes leaves a space before commas. I am not sure how to go about removing this space. I've been playing around with the following but it has not been working:
@char_count = 0
sentance.each_char{|char...
Hello,
I am having problems with an optional group in a regex (.NET syntax, and I'm using RegexOptions.Singleline).
"function (\w*).*?{(?:.*?\((.*?)\))?.*?}"
Also tried, to no avail:
"function (\w*)[^{]+{(?:.*?\((.*?)\))?.*?}"
It looks like the group is not optional, because if I just add two parenthesis in FunctionWithNoParameters ...
I have a variable that holds a number
var simpleNumber = 012345678;
I want to .split() this number and create an array that would be of each 3 numbers
the array should look like this
[012, 345, 678]
var splitedArray = simpleNumber.toString().split(/*how do i split this?*/);
it is part of a getRGB("ffffff") function, so i cant kn...
At the moment I have the following MySQL query:
SELECT
COUNT(*) AS `count`,
`v`.`value`
FROM `client_entity_int` AS `v`
INNER JOIN `client_entity` AS `e`
ON e.id = v.entity_id
WHERE (v.attribute_id = '1') AND (e.deleted = 0)
GROUP BY `v`.`value`
Which returns the following:
+-------+-------+
| count | value |
+-------+...
I have the following code in C:
char *str = "Hello World";
char *s = malloc(strlen(str));
int i =0;
for(;i<strlen(str)-5;i++)
{
s += *(str+i);
}
printf(s);
It shows nothing. What I want is to get the substring of str stored in s.
In Java I would do the following:
String str = "Hello World";
...
This question is related to this other question @ SuperUser.
I want to download the TED Talks and the respective subtitles for offline viewing, for instance lets take this short talk by Richard St. John, the high-resolution video download URL is the following:
http://www.ted.com/talks/download/video/5118/talk/70
And the respectiv...
Hey and happy holidays
I'm working in ruby on rails and need the following:
remove all "br" html tags between "code" html tags in a string of html. The "code" tags might occur more than once.
Now, it's not screen scrapping I'm trying to do. I have a blog and would like to allow people to use the code html tags only in the comments. S...
Hello to all. Need assistance to do this. Or advice about how to add string to string elements in array?
We have 2 txt files with 100 or more strings in each:
domain.txt
domain1
domain2
..
title.txt
title1
tilte2
..
and we have:
string link = < a h ref="http://www.domain.com" target="_blank">title< /a>
After reading files we would...
Hello everybody!
How can i cut off the last empty space?
a = ['Hello ','everybody ','! ']
for i in range(len(a)):
a[i,-1]=''
print a
...
How can I delete the \n and the following letters? Thanks a lot.
wordlist = ['Schreiben\nEs', 'Schreiben', 'Schreiben\nEventuell', 'Schreiben\nHaruki']
for x in wordlist:
...?
...
SharePoint Designer does not support the replace function directly.
What would be a function or call Template for this? I want to replace "-Y" with "Yes" and "-N" with "NO" in a string. E.g.:
Sample-Y, Sample1-N
Result as:
Sample Yes Sample1 No
...
for certain functions i want to create a copy of the string within the function and then manipulate this - for some strange reason, i cant get strcpy to work (gives me a segmentation fault) - i've also tried passing the arg as a string, this doesnt work either (g++ throws an error saying it expect a char*)
#include <iostream>
#include ...
Hello! I want to change every letter in a text to after next following letter. But this program doesnt work. Does anyone know why. Thanks in advance. There is also a minor problem with y and z.
import string
letters = string.ascii_lowercase
text=("g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb ...