Is it possible in C++ to replace part of a string with another string. Basically, I would like to do this
QString string("hello $name");
string.replace("$name", "Somename");
but I would like to use the Standard C++ libraries.
...
I am using Java and I am looking for String Collections (Sets and Lists) that are optimized in space and are fast. My strings are of fixed size: either 3 or 5 chars long.
Please suggest to me if there are any collection libraries available that can be best suited to me. I was thinking of some dictionary based collections.
Thanks.
...
If I try to do a .equals() on a null string in java, a null pointer exception will be thrown. I am wondering, if I am trying to compare if a string is equal to some constant string, can I do the following:
MY_CONSTANT_STRING.equals(aStringVariable)
I know it will work, but is this just really poor code?
...
Hi all,
I’m currently in the process of developing my own blogging system. Currently when you create a new post, you get the option to archive it categories of your own choise.
Currently I’m storing the categories as a VARCHAR value in a mysql database. As an example the field will contain 2,4,8 if the user has chosen the categories wi...
I'm writing a program that first queries with mySQL and then sorts that data. I want to be able to have a user type "python program_name.py mySQL_query" and have the program insert "mySQL_query" into the query at the beginning of the program. The issue I'm running into is the sys.argv command converts the input into a string, which mySQL...
I have a list of n strings (names of people) that I want to store in a hash table or similar structure. I know the exact value of n, so I want to use that fact to have O(1) lookups, which would be rendered impossible if I had to use a linked list to store my hash nodes. My first reaction was to use the the djb hash, which essentially d...
I am using SQL Server 2005 with the following query
SELECT *
FROM EMPLOYEE
WHERE EMP_NAME = 'ABCD'
It gave me the proper results and when i tried the same query with 'ABCD ', then also it gave me the same result!!!
I feel it should not give any results as there is no employee with name 'ABCD '
Or "WHERE" condition works like thi...
In my project there are some code snippets which uses StringBuffer objects, and the small part of it is as follows
StringBuffer str = new StringBuffer();
str.append("new " + "String()");
so i was confused with the use of append method and the + operator.
ie the following code could be written as
str.append("new ").append("String()...
When i try execute the following code, which should just print a slashy string in groovy console version 1.7.4 i get a compilation error:
println /slashy string/
if i change this to:
def s = /slashy string/;
println s
everything is fine and the expected string is printed.
Any ideas what i am doing wrong?
...
Hello everybody!
I'm searching for a "bad" hash function:
I'd like to hash strings and put similar strings in one bucket.
Can you give me a hint where to start my research?
Some methods or algorithm names...
Thnaks in advance!
Sebastian
...
hello - bit of a nightmare. Clients sent out a big email with in links in them which have subsequently changed!
just need to change
forthcoming-events/event/skills-xxx-XXX
to
forthcoming-events/event/skills
so just removing the '-xxx-XXX'. Any help majorly appreciated as struggling to find a solution.
...
i am comparing updates to two strings. i did a:
string1 != string2
and they turn out different. I put them in the "Add Watch" and i see the only difference is one has line breaks and the other doesnt'.:
string1 = "This is a test. \nThis is a test";
string2 = "This is a test. This is a test";
i basically want to do a compare bu...
I am trying to compare 2 strings but i just realized that one has some html formatting already.
How can i get these two strings to match when doing string1 == string2. (NOTE: i dont know what the HTML formatting is going to be upfront)
string1 = "This is a test";
string1 = "<font color=\"black\" size=\"1\">This is a test</font>";
...
We have an alpha numeric string (up to 32 characters) and we want to transform it to an integer (bigint). Now we're looking for an algorithm to do that. Collision isn't bad (therefor we use an bigint to prevent this a little bit), important thing is, that the calculated integers are constantly distributed over bigint range and the calcul...
Possible Duplicate:
What is the best way to convert between char* and System::String in C++/CLI
Hello,
I have a function in a c++ project using \clr something like:
int WINAPI dmtTest(char *pcertificate)
{
String^ sCertificate;
sCertificate = pcertificate; // how can I assign pcertificate to sCertificate?
...
writing a recursive string reverse function out of curiosity, but having a bit of problem with XOR there. The whole point of this function, is to not use iterator, which is why it is a recursive function. this is not homework, just curiosity.
private static char[] ReverseNL(char[] arr, int index)
{
var len = arr.Length;...
I am looking to create an auto incrementing unique string using PHP, containing [a-Z 0-9] starting at 2 chars long and growing when needed.
This is for a url shrinker so each string (or alias) will be saved in the database attached to a url.
Any insight would be greatly appreciated!
...
Hello,
i have a c++ dll that contains a function called DoIt :
int WINAPI DoIt()
{
SetCallback(pCallbackFunc);
LPSTR pRet = (LPSTR) LocalAlloc(LPTR, 1024);
memset(pRet, 0, 1024);
g_CALLBACK(pRet);
MessageBoxA(0,(LPSTR)pRet,"response",MB_ICONEXCLAMATION);
LocalFree(pRet);
return 1;
}
as you can see, this func...
I would like to filter HTTP_REFERER where visitors come to my site from search engines. I want to ignore storing HTTP_REFERER information for the visitors came from the search engines. Could you please help with the PHP script?
I have this, but not correct script:
<?
$exp_list = array('google', 'yahoo');
// exapmple of one HTTP_REFERE...
Hello,
I would like to make a whole word replace using php
Example :
If I have
$text = "Hello hellol hello, Helloz";
and I use
$newtext = str_replace("Hello",'NEW',$text);
The new text should look like
NEW hello1 hello, Helloz
PHP returns
NEW hello1 hello, NEWz
Thanks.
...