I was programming a small notepad like app with some extra functionalities.
I am using a rich textbox as the main area. My question is while performing operations on the contents of the textbox, like code formatting, highlighting, etc which might require reading each character and replacing wherever necessary. Moving back across text in...
I'm working on a piece of code that uses regex expressions to do a find/replace for emoticons in a chat. However, I want to use the same array of values and output them as a reference.
The regex works fine for my searches, but when I tried to do a replace on the regex search string before I output it for my help, I still end up with a s...
I am reading in a number of strings which have /'es through them, the most common example being dates/numbers like 05/06, 07/08, etc.
I am using ASP.NET MVC2 and generating links off of these strings read out of DB, which therein lies the problem.
Obviously a link to:
www.mysite.com/yearperiod/05/06/detail
will not work the same as a...
Silly question, but I do not know how to find (2000) into a regular expression and replace it with [2000]
...
How to split a string on numbers and substrings?
Input: 34AG34A
Expected output: {"34","AG","34","A"}
I have tried with Regex.Split() function, but I can not figure out what pattern would work.
Any ideas?
...
What is the difference between String str = new String("SOME") and String str="SOME"
Does these declarations gives performance variation.
...
I need to store the following strings in 3 char * variables in C:
[foo]
[foo]:[bar]
[foo]:[bar]:[tat]
Each individual string such as "foo" is received at one point of time via a char* pointer, the corresponding output string is produced immediately before receiving the second string, and the total number of individual strings is known...
Possible Duplicate:
Is there an alternative to string.Replace that is case-insensitive?
I need to find and replace a string and ignore the case in c#. What is the best way I can accomplish this? Regex?
...
I'm storing a string in a database with a value such as "020734". I would like to be able to pull the string apart.
I have:
String values = "020734";
I need:
String values = "020734";
String value1 = "02";
String value2 = "07";
String value3 = "34";
Could you guys possibly point me in a general direction?
...
Hi,
I have a string:
"116,118,120,130"
and will want to delete either the first, last or any value in between upon execution.
To to this I was using:
"116,118,120,130".gsub('118','')
but the problem is the string contains an extra unnessesary comma:
"116,,120,130"
and if I use
"116,118,120,130".gsub(',116','')
it will remo...
Hi,
I'm using Python 3.1 to write a simple game involving naming state capitols. I think I have some kind of type mismatch but I don't know what it is.
I think it's when I compare the player's answer to the real answer, but don't know how to make it right.
from random import *
states = {}
print ("Guess State Capitols")
statefile = o...
That is, going from ABCD -> ABC
...
Hi
I'm looking for a way that I can extract the first letter of each word from an input field and place it into a variable.
Example: if the input field is "Stack-Overflow Questions Tags Users" then the output for the variable should be something like "SOQTU"
Any help is appreciated.
Thanks
...
Is there a better/easier way to create a \w+ string from an existing string?
char *FixName(char *name)
{
char *ptr, tmp;
char *new = malloc(strlen(name)+1);
sprintf(new, "str_");
for (ptr = name + 4; *ptr; ptr++)
{
if ((*ptr >= '0' && *ptr <= '9') ||
(*ptr >= 'A' && *ptr <= 'Z') ||
...
I want to remove some rogue HTML from a DB field that is supposed to contain a simple filename. Example of ok field:
myfile.pdf
Example of not ok field:
myfile2.pdf<input type="hidden" id="gwProxy" />...
Does anyone know a query I can run that can remove the HTML part but leave the filename? i.e. remove everything from the first < ...
I'm writing an application that involves having users enter time's in the following format:
1m30s # 1 Minute, 30 Seconds
3m15s # 3 Minutes, 15 Seconds
2m25s # 2 Minutes, 25 Seconds
2m # 2 Minutes
55s # 55 Seconds
The data can have a single "minute designation", a single "second designation", or both. What is the proper way ...
I have a working solution right now, but it seems really ugly for something so (seemingly) simple.
I tried just breaking it when adding a word goes over the halfway mark, both splitting before and after adding the word, but depending on the length of the words it's either imbalanced towards the first or second line.
Sample inputs t...
Hi,
I have used a string in C# where i am using C# in Visual studio 2008. I wanted to convert it to uppercase.
string lowerString = txtCheck.Text;
string upperString = lowerString.ToUpper();
Normally this is how i should have used, But the thing is i didn't get any error when i used it like this
string upperString = lowerString.ToUp...
I don't know if this is possible using regex. I'm just asking in case someone knows the answer.
I have a string ="hellohowareyou??". I need to split it like this
[h, el, loh, owar, eyou?, ?].
The splitting is done such that the first string will have length 1, second length 2 and so on. The last string will have the remaining charact...
What is the best way performance wise to take a list of words and turn them into phrases in python.
words = ["hey","there","stack","overflow"]
print magicFunction(words)
>>> ["hey","there","stack","overflow", "hey there stack","hey there", "there stack overflow","there stack", "stack overflow", "hey there stack overflow" ]
Order does...