string

Getting a property from an representation of it

I have some doubt about the title, but I couldn't come up with anything better. Say I have the following enum public enum ClassProperties { Primary = 0, Secondary = 1, } And a class that looks this public class Test { Primary { get { return _primary; }} Secondary { get { return _secondary; }} // more irrelevant...

Accessing built-in string hash functions of Lua

Lua has built-in string hashing functionality for storage of strings inside its maps. It is possible to access it? Or is there another string hash function already available in the lua language/libraries? ...

IPhone Float to String issue

I can't live another day without knowing why this is happening. I have an iPhone application using Corelocation and here is the issue: GPSLocation.m - sends long/lat coordinates which are floats to class UserSettings.m (which is a singleton class) _ UserSettings.m - Then cast the values into a predefined strings from a f...

How does one loop through a set of string value names in a registry key?

Hey all, I need to use VBScript and loop through a set of registry string value names located within a specific key such as: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" and delete all the string values except for ones that I specifiy. I was able to successfully delete a specific string value using DeleteValue and...

string manipulation - re.sub in jython

Let say i have a string like this 'this is a statement' and if i want to search and replace string with this 'this ** a statement' string to search for this is a statement , this si a statement , this i a statement and any combination convert them into this trim a statement i.e for any word combination between this & a statement ...

convert digital display format

quick question, I have some integrate variable in javascript, say: 123456, or 123456789, it can be any valid number. Now, I would like to convert the number to a string like "123,456" or "123,456,789". Does anyone have a good algorithm for this? Of course, it should work for any numbers. For example: for 2000 ---> 2,000; 123456--->123,45...

LINQ to SQL - Format a string before saving?

I'm trying to convert an existing (non-LINQ to SQL) class into a LINQ to SQL entity class which has an existing (db column) property like: public string MyString { get { return myString; } set { myString = FormatMyString(value); } } Is there a way to do this sort of processing on the value of entity class property before savin...

String comparison oddities in 4GL

OK, so I've learned the hard way that string comparison works ... differently in Progress 4GL. For example, "x " and "x" seem to be the same thing, and "ß" is equal to "ss" - but "ö" is not equal to "oe". Is there any comprehensive list of what substrings are considered equal in ABL? I've checked the documentation, but wasn't able to ...

Need Good C++ Libraries For Strings & HTTP Streams

Hi, I'll soon be starting a project of mine that heavily involves reading and interacting with websites. So I'd like to start pulling in some decent libraries to cut down on some of the dirty work that needs to be done in C++. Thus far I've found 'The Better String Library' for string manipulation. Any other suggestions? ...

A quick string checksum function in Perl generating values in the 0..2^32-1 range

I'm looking for a Perl string checksum function with the following properties: Input: Unicode string of undefined length ($string) Output: Unsigned integer ($hash), for which 0 <= $hash <= 2^32-1 holds (0 to 4294967295, matching the size of a 4-byte MySQL unsigned int) Pseudo-code: sub checksum { my $string = shift; my $hash...

Could I change the reference inside one method with this reference as argument in Java?

private static void changeString(String s) { s = new String("new string"); } public static void main(String[] args) { String s = new String("old string"); changeString(s); System.out.println(s); // expect "new string" } How could I make the output of "new string" happen with s as the only argument to method changeStrin...

Removing similar characters in a string

Is there any built-in method to remove similar characters in a string? Examples: aaaabbbccc -> abc aabbccaa -> abc Thanks ...

Win32 development - String related datatypes in C++

Hi, I was going to start with Win32 app development. Before I could get the first window to display i was ready to give up! I was overwhelmed by the number of datatypes you need to know about before you can write a simple WinMain and WndProc. (unless you copy-paste of course!) Especially these - LPSTR LPCSTR LPWSTR LPCWSTR Can so...

Regex: Match words in sentence PHP

Hi, I have an array with words like $arr = array("go", "walk", ...) I would like to replace these words with links f they are matched in sentences. But it should be only if they match exactly (for example "walk" should match "Walk" or "walk!" but not also "walking") And the replacement should be a simple link like: < a href='#walk' >...

PHP - Loopless way to split a string into a multidimensional array

How do I split a string into a multidimensional array in PHP without loops? My string is in the format "A,5|B,3|C,8" ...

auto-tokenize user agents strings for statistics?

We keep track of user agent strings in our website. I want to do some statistics on them, to see how many IE6 users we have ( so we know what we have to develop against), and also how many mobile users we have. So we have log entires like this: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; FunWebProducts) Mozilla/4.0 (compatible; ...

How can I get the full string of PHP’s getTraceAsString()?

I'm using getTraceAsString() to get a stack trace but the string is being truncated for some reason. Example, an exception is thrown and I log the string using: catch (SoapFault $e) { error_log( $e->getTraceAsString() ) } The string thats prints out is: #0 C:\Somedirectory\Somedirectory\Somedirectory\Somedir\SomeScript.php(10): S...

Can fscanf() read whitespace?

I've already got some code to read a text file using fscanf(), and now I need it modified so that fields that were previously whitespace-free need to allow whitespace. The text file is basically in the form of: title: DATA title: DATA etc... which is basically parsed using fgets(inputLine, 512, inputFile); sscanf(inputLine, ...

Delphi; performance of passing const strings versus passing var strings

Quick one; am I right in thinking that passing a string to a method 'as a CONST' involves more overhead than passing a string as a 'VAR'? The compiler will get Delphi to make a copy of the string and then pass the copy, if the string parameter is declared as a CONST, right? The reason for the question is a bit tedious; we have a legacy ...

what is wrong in this string?

string.Format("{Find Name='{0}'}", name) it throws Exception at runtime saying input string was in wrong format. What is wrong in this string? ...