string

Parsing a string with tokens for the first and last words (in C)

I'm going to try to explain the problem. I am getting a string containing a registry key. For example: HKEY_CURRENT_USER\Software\MyProgram\SomeOtherValue\SomeKey now, I need to parse that string into 3 different char (or char *) variables. After the parsing it'll be something like: string1 = HKEY_CURRENT_USER string2 = \Software\My...

Unfamiliar C syntax in Objective-C context

I am coming to Objective-C from C# without any intermediate knowledge of C. (Yes, yes, I will need to learn C at some point and I fully intend to.) In Apple's Certificate, Key, and Trust Services Programming Guide, there is the following code: static const UInt8 publicKeyIdentifier[] = "com.apple.sample.publickey\0"; static const UInt8 ...

Java - Parse a Multi-delimited/dimensional String

I have the following string with separate delimiters that needs to be parsed out and I am running into a bit of a wall at the moment. example: category 1---category 2;subgroup 1||subgroup 2---subgroup 1;value 1||value2---value 3 I wanted to re-arrange into the following grouping: category 1;subgroup 1;value1;subgroup 2;value 2;catego...

Given an RE, derive the largest substring match

I'm looking for a bit of code that will: Given regular expression E, derive the longest string X such that for every S, X is a substring of S iff S will match E examples: E = "a", X = "a" E = "^a$", X = "a" E = "a(b|c)", X = "a" E = "[ab]", X = "" context: I want to match some regular expressions against a data store that only sup...

Comparing wstring with ignoring the case.

I am sure this would have been asked before but couldn't find it. Is there any built in (i.e. either using std::wstring's methods or the algorithms) way to case insensitive comparison the two wstring objects? ...

MySQL PHP mysql_real_escape_string() - is this value not a string?

I am trying to update a record with the info from a multiple select box, I had it working fine when I was using INSERT INTO to add a new row, but now that I am trying to add it to this code that is using mysql_real_escape_string() it is returning the error message at the bottom of this post. I presume it has something wrong with the val...

Is string a value type or a reference type?

I just can't find a "good" explanation for this... ...

Join strings in qql update query

i have two fields with a string in it, and i want a combination of those in a third field like: UPDATE table SET field3=field1 . '_' . field2 what would be the right syntax for that? it is mysql okay that CONCAT Thing worked, is there a function to convert those fields to lowercase?? ...

Parsing a string within a string?

I have a function which accepts a string parameter such as: "var1=val1 var2=val2 var3='a list of vals'"; I need to parse this string and pick out the var/val combination's. That is easy enough until introducing something like var3='a list of vals'. Obviously I can't explode the string into an array using a white space delimiter which ...

C++ string.compare()

I'm building a comparator for an assignment, and I'm pulling my hair out because this seems to simple, but I can't figure it out. This function is giving me trouble: int compare(Word *a, Word *b) { string *aTerm = a->getString(); string *bTerm = b->getString(); return aTerm->compare(bTerm); } Word::getString returns a st...

In C - check if a char exists in a char array

I'm trying to check if a character belongs to a list/array of invalid characters. Coming from a Python background, I used to be able to just say: for c in string: if c in invalid_characters: #do stuff, etc How can I do this with regular C char arrays? ...

Equality testing in Javascript

just trying to test for equality in this piece of code, but getting a fail. <input type="text" name="dave_blah"/> <input type="text" name="dave_bleh"/> I then access the name values of each of these inputs and assign them to two variables, name1 and name2. I then extract the first part of the name,delimited by a "_". var oldName = n...

How to convert hex string to float in Java?

How to convert hexadecimal string to single precision floating point in Java? For example, how to implement: float f = HexStringToFloat("BF800000"); // f should now contain -1.0 I ask this because I have tried: float f = (float)(-1.0); String s = String.format("%08x", Float.floatToRawIntBits(f)); f = Float.intBitsToFloat(Integer.valu...

How to get time elapsed in milliseconds

Since performance of string concatenation is quite weak in VB6 I'm testing several StringBuilder implementations. To see how long they're running, I currently use the built-in Timer function which only gives me the number of seconds that have passed after midnight. Is there a way (I guess by importing a system function) to get somet...

print spaces with String.format()

how I can rewrite this: for (int i = 0; i < numberOfSpaces; i++) { System.out.print(" "); } using String.format()? PS I'm pretty sure that this is possible but the javadoc is a bit confusing. ...

How do I create subset words for an anagram application (php) ?

I created an anagram creating application, by creating an anagram field in my database, with a lower cased alphabetically stored string. For example, suction becomes cinostu, ear becomes aer, and so on. What I want to do now is create sub words from the original anagram searched for. Example: How would you go about pulling the subset ...

Get Last Error from LogonUser function and return it as a String?

Hey Folks, I am just wondering how i can get the error causing LoginUser function to fail in my C++ program and return it as a String? JNIEXPORT jstring JNICALL Java_com_entrust_adminservices_urs_examples_authn_LdapAuthenticator2_takeInfo(JNIEnv *env, jobject obj, jstring domain, jstring id, jstring idca, jstring password) { const...

unique integer/long hash key generation over strings for faster compairson

I'm curious how others have solved this problem, and what problems might lurk behind the naive solution: I have a system which processes stock market data. There are tens of thousands of symbols, with associated prices/sizes, flowing into the system at the rate of several thousand every millisecond. One of the basic operations that ne...

Simplifying Data with a for loop (Python)

Hi, I was trying to simplify the code: header = [] header.append(header1) header.append(header2) header.append(header3) header.append(header4) header.append(header5) header.append(header6) where: header1 = str(input.head...

Parsing XML file using NSXMLParser

Hello I have to parse an XML file using NSXMLParser. There are so many HTML tags in them, so when I am trying to parse it, it will store the string up to that and then again go to found character method and starts to append it. my code is: if (Bio_CResults) { [BioResults appendString: string]; [Info appendString:string]; [stringar...