Let's suppose that have a stream of text (or Reader in Java) that I'd like to check for a particular string. The stream of text might be very large so as soon as the search string is found I'd like to return true and also try to avoid storing the entire input in memory.
Naively, I might try to do something like this (in Java):
public b...
I need to cut off the last seven characters of a string (a string that is stored in a hash). What is the easiest way to do that in perl? Many thanks in advance!
...
Hi,
Suppose I had the string "1 AND 2 AND 3 OR 4", and want to create an array of strings that contains all substrings "AND" or "OR", in order, found within the string.
So the above string would return a string array of {"AND", "AND", "OR"}.
What would be a smart way of writing that?
EDIT:
Using C# 2.0+,
string rule = "1 AND 2 AND 3...
Hello,
I'm parsing a source file, and I want to "suppress" strings. What I mean by this is transform every string like "bla bla bla +/*" to something like "string" that is deterministic and does not contain any characters that may confuse my parser, because I don't care about the value of the strings. One of the issues here is string fo...
I am saving an XMLDocument object to disk using the Save (string) function. When I do this I get a "Could not find a par of the path" error.
I have tried passing the characters as "&", "&", "%26", "\26", and "\38". What am I missing? Note that I am not talking about the content of the file -- but the filename.
Dim todocument As New ...
Consider the following:
<div id=hotlinklist>
<a href="foo1.com">Foo1</a>
<div id=hotlink>
<a href="/">Home</a>
</div>
<div id=hotlink>
<a href="/extract">Extract</a>
</div>
<div id=hotlink>
<a href="/sitemap">Sitemap</a>
</div>
</div>
How would you go about taking out the sitemap line with regex in python?
<...
I've got city, state, country strings like:
NEW YORK, NY, US
REDMOND, WA, US
US
HONG KONG
CALGARY, CA
E. SYRACUSE, NY, US
I'd like to transform them to their proper case (New York, NY, US; etc). Whats a quick way to do this in PHP?
...
(I have read Apple's memory management guide, as well as other memory management help here, but am still confused on the following)
What should I do for memory management with convenience methods in a loop? Do I need to explicitly create an autorelease pool and then drain it. Or is it all automagic?
e.g.
for (i=0; i<numFilePaths; i++...
What is the best algorithm to match or compute the distance between two strings in C# when the order or number of times a word appears is not important?
Best means:
Would mostly agree with a human match
Elegant
Efficient
Scalable, so that an input string could be matched to a potentially large collection of other strings
Related que...
How can you display a long string, website address, word or set of symbols with automatic line breaks to keep a div width? I guess a wordwrap of sorts. Usually adding a space works but is there a CSS solution such as word-wrap?
For example it (very nastily) overlaps divs, forces horizontal scrolling etc.
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...
HI,
I have a string that looks like
/dir/dir1/filename.txt
I want to replace the "filename.txt" with some other name leaving the "/dir/dir1" intact
so after the replace the string would look like
/dir/dir1/newfilename.txt
how would I do that using RegExp in Perl considering that I don't know the value of "filename"
Many Thanks...
Hi,
I have a string like this:
This <span class="highlight">is</span> a very "nice" day!
How should my RegEx-pattern in VB look like, to find the quotes within the tag? I want to replace it with something...
This <span class=^highlight^>is</span> a very "nice" day!
Something like <(")[^>]+> doesn't work :(
Thanks
...
Given a list L of n character strings, and an input character string S, what is an efficient way to find the character string in L that contains the most characters that exist in S? We want to find the string in L that is most-closely made up of the letters contained in S.
The obvious answer is to loop through all n strings and check to...
Hi, I have been messing around with recursion today. Often a programming technique that is not used enough.
So.. I set myself the task to recursively reverse a string, heres what I came up with :
//A method to reverse a string using recursion
public String reverseString(String s){
char c = s.charAt(s.length()-1);
if...
USER = "user"
PASS = "pass"
QUERY = "SELECT c1, c2, c3, c4, c5, c6, c7 FROM table"
SQLITE_SCHEMA = 'c1, c2, c3, c4, c5, c6, c7'
sqlite_db = SQLite3::Database.new('sqlite.db')
odbc_db = DBI.connect('DBI:ODBC:database', USER, PASS)
odbc_db.select_all(QUERY) do |entry|
sqlite_db.execute "insert into smnt (" + SQLITE_SCHEMA + ") values ...
Hey!
My idea:
I select a string/text and drop it on my app's icon.
My app comes up and does fancy things with the string.
Now my question is how I can do it that I can drop it on the app, how I can notify my app and how my app gets the string.
Any suggestions?
Thanks for answering and any idea! :)
...
How could the following code sometimes evaluate to false?
(transport.responseText == '1' || transport.responseText == 'CARD_VALID')
My code is as follows:
if (transport.responseText == '1' || transport.responseText == 'CARD_VALID') {
// do something....
}
else if (transport.responseText == 'CARD_INVALID' || transport.responseText ==...
Hi guys
I am having some issues trying to convert a double to C++ string. Here is my code
std::string doubleToString(double val)
{
std::ostringstream out;
out << val;
return out.str();
}
The problem I have is if a double is being passed in as '10000000'. Then the string value being returned is 1e+007
How can i get th...
Hi All,
I am building a iPhone app which uses c# web services. My c# web services takes user details and validates against my DB and returns xml files.
So Now the issue is how to encrypt user details(username and password are 10chars each) in objective c and decrypt in C#.
I am very new to cryptography, which method is the best. will ...
This problem is similar to blind SQL injections. The goal is to determine the exact value of a string, and the only test you can do is to see if a DOS-style wildcard (? = any character, * = any number of any characters) you specify is matched by the string. (So practically you only have access to a bool DoesWildcardMatch(string wildcard)...