It's been awhile since I worked with the standard C library's string parsing code (sprintf, atoi, etc).
My specific, current need is as follows:
advance_buf( const char*& buf, const char* removed_chars, int size );
It should advance the buf pointer to beyond the group of whitespace and copy the removed characters into removed_chars ....
I want to write a Shell (AWK, Sed also fine) program to take as a input a SINGLE line of text.
Which will have arbitrarily spread integer strings in it. e.g
"12884 and 111933 are two numbers and 323232 is also a number"
I want the output to be
"12,884 and 1,11,933 are two numbers and 2,23,232 is also a number"
If this was PHP a sim...
I want to replace
! = change
@ = static(does not)
$ = Want to replace
I got a sting like this @!$!
How do I replace the $ with something else?
EDIT: I need to use Regex as the string may appear anywhere!
...
Hi,
I have some html text that I set into a TextField in flash. I want to highlight links ( either in a different colour, either just by using underline and make sure the link target is set to "_blank".
I am really bad at RegEx. I found a handy expression on RegExr :
</?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)/?>
b...
In C#, what is the fastest way to detect duplicate characters in a String and remove them (removal including 1st instance of the duplicated character)?
Example Input: nbHHkRvrXbvkn
Example Output: RrX
...
Hi,
I am working on a project that generates code at runtime based on meta-model. I've used vb.net xml literals for this, but today I ran accross StringTemplate project. Has anybody successfully used this library in C# project.
...
I have the the string "re\x{0301}sume\x{0301}" (which prints like this: résumé) and I want to reverse it to "e\x{0301}muse\x{0301}r" (émusér). I can't use Perl's reverse because it treats combining characters like "\x{0301}" as separate characters, so I wind up getting "\x{0301}emus\x{0301}er" ( ́emuśer). How can I reverse the str...
Noticed this today when a patch was submitted with the following line:
lblCompletionTime.Text = String.Concat(trainingSkill.EndTime.ToLocalTime())
I can understand why the contributor used that syntax as above line concatenated two strings to form a multi-part date/time string.
Is there some hidden reason for having a single paramete...
Hey, I'm writing my first Rails app, and I'm trying to replace the underscores form an incoming id name with spaces, like this:
before: test_string
after: test string
How can I do this? Sorry if this is a bit of a dumb question, I'm not very familiar with regular expressions...
...
I have a need to perform search and replace operations on large blocks of HTML. I do not wish to change anything that is part of an html tag (like urls) - I also do not wish to change urls OUTSIDE of html tags. I have a partial solution for matching a word that is not inside of html (src):
word(?!([^<]+)?>)
while regex buddy also say...
I have this DOM structure:
<span id="aa"><a id="bb">myname</a> test test test</span>
I want to be able to select #aa and then split #bb away from the text "test test test" since I need to perform some string operations (replace) with the text. How do I select just the text in this case? And then after the string replace operation, I w...
Hello Everybody:
I'm importing a csv file in C#, sometimes with '.', sometimes with ',' as decimal separator.
Is there a best way of determinate the decimal separator better than counting from the last char down to the first apperance?
Thanks in advance.
Franklin Albricias.
...
Consider the requirement to find a matched pair of set of characters, and remove any characters between them, as well as those characters/delimiters.
Here are the sets of delimiters:
[] //square brackets
() //parenthesis
"" //double quotes
'' //single quotes
Here are some examples of some strings that should match:
**Given** ...
Consider a string array shaped like this:
string[] someName = new string[] { "First", "MiddleName", "LastName" };
The requirement is to get the first character from each element in the array.
i.e.
FML
Previously have tried:
string initials = string.Concat(someName.Select(x => x[0]));
Question: What LINQ query would you wri...
I am looking for a reliable method to replace a sequence of chars in a text file. I know that the file will always follow a specific format and that I need to replace a specific range of chars (ie start at char 20, replace the next 11 chars with '#')
I have found several examples using sed and awk which accomplish this on most files. ...
Hi, I want to get the characters after the last / in an url like http://www.vimeo.com/1234567
How do I do with php?
...
Hiya,
Despite using PHP for years, I've never really learnt how to use expressions to truncate strings properly... which is now biting me in the backside!
Can anyone provide me with some help truncating this? I need to chop out the text portion from the url, turning
<a href="link.html">text</a>
into
<a href="link.html"></a>
Any ...
I want this url http://www.youtube.com/watch?v=dgNgODPIO0w&feature=rec-HM-fresh+div to be transformed to: http://www.youtube.com/v/dgNgODPIO0w with php.
...
When you use the Trim() method on a string object, you can pass an array of characters to it and it will remove those characters from your string, e.g:
string strDOB = "1975-12-23 ";
MessageBox.Show(strDOB.Substring(2).Trim("- ".ToCharArray()));
This results is "75-12-23" instead of the expected result: "751223", why is this?
Bon...
I'm developing a small application with needs to replace .NET style "variables" in strings with their values. An example is given below:
Replace:
"{D}/{MM}/{YYYY}"
With:
"31/12/2009"
I have decided to use Regex to find the occurrences of "{var}" but I'm not too sure how to properly go about it.
...