The Problem: A large static list of strings is provided. A pattern string comprised of data and wildcard elements (* and ?). The idea is to return all the strings that match the pattern - simple enough.
Current Solution: I'm currently using a linear approach of scanning the large list and globbing each entry against the pattern.
My Que...
How can I replace this "a b" by "a b" in j2me?
the replace() method doesn't accept Strings, but only chars. And since a double space contains two chars, I think i have a small problem.
...
Given a dictionary of words and an initial character. find the longest possible word in the dictionary by successively adding a character to the word. At any given instance the word should be valid word in the dictionary.
ex : a -> at -> cat -> cart -> chart ....
...
Hi, I need to know how I can replace the last "s" from a string with ""
Let's say I have a string like testers and the output should be tester.
It should just replace the last "s" and not every "s" in a string
how can I do that in PHP?
...
I have to write my own hash function. If I wanted to just make the simple hash function that maps each letter in the string to a numerical value (i.e. a=1, b=2, c=3, ...), is there a way I can perform this hash on a string without having to first convert it to a c-string to look at each individual char? Is there a more efficient way of h...
How do I do this correctly:
I want to do a query like this:
query = """SELECT * FROM sometable
order by %s %s
limit %s, %s;"""
conn = app_globals.pool.connection()
cur = conn.cursor()
cur.execute(query, (sortname, sortorder, limit1, limit2) )
results = cur.fetchall()
All works fine but the o...
I'm writing a tcp client in Delphi for a server that has a series of messages defined as c structs. Below is an example conversion of one of the messages:
struct {
int32 Reserved;
cstring Name;
int32 flags;
}
msg1 = record
Reserved : integer;
Name : cstring???;
flags : integer;
end
Googling the type tell...
For example:
(1).SomeFunction().Equals("one")
(2).SomeFunction().Equals("two")
I really only need it for digits 1-9 in the case I'm working with, should I just use a switch/select case?
Update I won't need localization in this case either.
Update 2 Here's what I ended up using:
Private Enum EnglishDigit As Integer
zero
one
...
Could anyone check my solution?
I want to return true if the string "cat" and "dog" appear the same number of times in the given string. There are various strings with different numbers of "cat" and "dog".
public boolean catDog(String str)
{
int catAnswer = 0;
int dogAnswer = 0;
int cat_Count = 0;
int dog_Count = 0;
for (...
string Haystack[] = { "Alabama", "Alaska", "American Samoa", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia",
"Florida", "Georgia", "Guam", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky",
"Louisiana", "Maine", "Maryland", "Massa...
<c:forEach items="${myParams.items}" var="currentItem" varStatus="stat">
<c:set var="myVar" value="<c:out var="myVar" />" />
</c:forEach>
I want to concatenate the values of currentItem.myVar and output it at the end of the loop, problem is I can't figure out how to do this...
(Preferably not using Java)
...
I'd like to be able to pull users from a database using either a supplied e-mail address or the user id (an integer). To do this, I have to detect if the supplied string is an integer, or an e-mail. Looking for the fastest way to do this. Thanks.
def __init__(self, data):
#populate class data
self._fetchInfo(data)
def _fetc...
I'm trying to return a string from a function. Which basically adds some chars together and return the string representation.
string toString() {
char c1, c2, c3;
// some code here
return c1 + c2; // Error: invalid conversion from `char' to `const char*'
}
it is possible to return boolean values like return c1 == 'x'. Isn't i...
I am using COM Interop. I have a call in VB6 which returns a string of roughly 13000 chars. If I execute the call in pure VB6 it takes about 800ms to execute. If I execute it via c# and COM Interop it takes about 8 seconds. I'm assuming the delay is caused by marshaling.
If I am correct about marshaling, I'd be grateful if someone coul...
Lets say I have the string:
"MyNamespace.SubNameSpace.MyClassName"
How do I extract just everything after the last period, "MyClassName"
...
My static method returns the following concatenated string like this
return (Sb.ToString() + " " + ds.Tables[1].Rows[0].ItemArray[0].ToString() + " " + ds.Tables[2].Rows[0].ItemArray[0].ToString());
Is this a good/bad practise or should i use stringbuilder for it....
...
I have a search page where I would like to stop the user entering a ' into textboxes, or replace it with a suitable character. Can anyone help me achieve this in asp.net vb ?
For example if a user searches for O'Reilly the search crashes with error:
Line 1: Incorrect syntax near 'Reilly'. Unclosed quotation mark before the character ...
I want to be able to find and highlight a string within a string BUT I no not want to remove the space.
So if my original string is :
There are 12 monkeys
I want to find '12 mon' and highlight those characters ending up with :
There are < font color='red' >12 mon< /font >keys
BUT I also want the same result if I search for '12mon' ...
How can i do a Bitwise OR on strings?
A:
10001
01010
------
11011
Why on strings?
The Bits can have length of 40-50.Maybe this could be problematic on int ?
Any Ideas ?
...
I am trying to combine multiple audit tables, and then filter the results into an excel sheet. The Union All and parameters make the query in excess of 1200 characters. It appears the string is truncated when running this. What recommendations can anyone make. I have no control over the database structure and am only reading foxpro free ...