Hi,
Let's say I'm parsing a file, which uses ; as the comment character. I don't want to parse comments. So if I a line looks like this:
example.com. 600 IN MX 8 s1b9.example.net ; hello!
Is there an easier/more-elegant way to strip chars out other than this:
rtr = ''
for line in file:
trig = False
...
I need to write some code that will search and replace whole words in a string that are outside HTML tags. So if I have this string:
string content = "the brown fox jumped over <b>the</b> lazy dog over there";
string keyword = "the";
I need to something like:
if (content.ToLower().Contains(keyword.ToLower()))
content = conten...
I have some HTML/CSS/JavaScript with painfully long class, id, variable and function names and other, combined strings that get used over and over. I could probably rename or restructure a few of them and cut the text in half.
So I'm looking for a simple algorithm that reports on the longest repeated strings in text. Ideally, it would r...
I need to write some code that performs an HTML highlight on specific keywords in a string.
If I have comma separated list of strings and I would like to do a search and replace on another string for each entry in the list. What is the most efficient way of doing it?
I'm currently doing it with a split, then a foreach and a Regex.Mat...
I've come to the conclusion that python has a function for just about everything I could ask for. It's just a matter of actually finding these functions. Is there a function that will trim not only spaces for whitespace, but also tabs?
Thanks :)
...
I have a list of questions in a table, some of which are only to be displayed if certain criteria are met. A record might have criteria as simple as 4002=Y where 4002 is the question number and Y is the answer. If 4002=Y then the question is to be displayed.
For records with only one criteria I have no problem.
But then there are reco...
In j2me ,i have editfield which takes its input ,in it we can enter 3 digits
when i enter first and third ,leaving 2nd digit empty ,
how to remove empty digit thanks
...
I want to move some char eg.(/,\,/t..etc) from mysql result. Can I strip every char with one function? I want to know this function.Help me!
...
Here is a design though: For example is I put a link such as
http://example.com
in textarea. How do I get PHP to detect it’s a http:// link and then print it as
print "<a href='htttp://example.com'>http://example.com</a>";
I remember doing something like this before however, it was not fool proof it kept breaking for compl...
I need help converting this string --> 20090727 10:16:36:643 to --> 07/27/2009 10:16:36
The original date and time are being returned by the SynchronizationAgent.LastUpdated() function, which returns a String in the above format.
Original question:preserved for reference
I have this -->
HUD.LastSyncDate = mergeSubscription.Synchro...
I'm trying to replace "\v" in the string "Lapensee\v" with ""
string a = "Lapensee\v";
string b = a.Replace("\\v", "");
Console.WriteLine(b);
Output: Lapensee\v
Can anyone explain why this doesn't work?
...
I want to truncate some text (loaded from a database or text file), but it contains HTML so as a result the tags are included and less text will be returned. This can then result in tags not being closed, or being partially closed (so Tidy may not work properly and there is still less content). How can I truncate based on the text (and p...
I'm very poor with regexps but this should be very simple for someone who knows regexps.
Basically I will have a string like this:
<if>abc <else>xyz
I would like a regexp so if the string contains <if> <else>, it splits the string into two parts and returns the two strings after <if> and <else>. In the above example it might return a...
Hi,
I have a string which contains the text of an article. This is sprinkled with BBCodes (between square brackets). I need to be able to grab the first say, 200 characters of an article without cutting it off in the middle of a bbcode. So I need an index where it is safe to cut it off. This will give me the article summary.
The summa...
I am pulling information from a binary file in C and one of my strings is coming out as \\b\\3777\\375\\v\\177 in GDB. I want to be able to parse this sort of useless data out of my output in a non-specific way - I.e anything that doesn't start with a number/character should be kicked out. How can this be achieved?
The data is being buf...
Does anyone have a more sophisticated solution/library for shortening strings with JavaScript, than the obvious one:
if(string.length > 25) {
string = string.substring(0,24)+"...";
}
...
Hi
How can I convert a std::string to LPCSTR? Also, how can I convert a std::string to LPWSTR?
I am totally confused with these LPCSTR LPSTR LPWSTR LPCWSTR?
Are LPWSTR and LPCWSTR are the same?
...
I am using Lucene in an application. As such I have a form that lets users build a query by selecting what they want to search from dropdowns.
Once a user submits, I build the query and it comes down to something like this:
var formedQuery= string.Empty;
foreach(var field in fields)
{
if (field.name != 'condition so you never know w...
I'm trying to parse some input on an embedded system.
I'm expecting something like this:
SET VARNAME=1,2,3,4,5,6,7,8,9,10\0
When I'm converting the separate strings to ints, both atoi() and strtol() seem to be returning 0 if the string begins with 8.
Here is my code:
char *pch, *name, *vars;
signed long value[256];
int i;
#ifdef UA...
I have a string which contains a mixture of upper and lower case characters, for example "a Simple string" . What I want to do is to convert first character of each word ( I can assume that words are separated by spaces) into upper case. So I want the result as "A Simple String". Is there any easy way to do this? I don't want to split th...