string

Pad a number with starting zero in .Net

Hi, I have a requirement to pad all single digits numbers with a starting zero. Can some one please suggest the best method? (ex 1 -> 01, 2 -> 02, etc) ...

Where are the operations for String , Int32, etc are defined?

I was looking at the String and Int32 types through the reflector but couldn't find any operators that are defined. If they aren't defined, how do +/-, etc works on these types? ...

There are Strings in C++?

I have been learning C++ with some books from school that are from the 80's and I'm not really sure if they are strings in C++ or just really long arrays of type char. Can anyone help? ...

Erlang Building Dynamic File Names

I am trying to create a file with a name based on an integer value from a function, clearly below does not work but gives you the idea : getValue() -> 1. createFile() -> {ok, File} = file:open( getValue(), [write]), io:format(File,"Test~n"), file:close(File). This ought to be simple, even with Erlangs lack of support for...

Can you translate php function quoted_printable_decode() to an NSString-based, objective-C function / category method?

In http://php.net/quoted_printable_decode, I found ways to do it using preg_replace. Anyone who knows any code that could convert a normal NSString to something RFC 2045 section 6.7? Thanks in advance! ...

why doesn't std::string provide implicit conversion to char*?

std::string provides const char* c_str ( ) const which: Get C string equivalent Generates a null-terminated sequence of characters (c-string) with the same content as the string object and returns it as a pointer to an array of characters. A terminating null character is automatically appended. The returned a...

C++ scanner (string-fu!)

I'm writing a scanner as part of a compiler. I'm having a major headache trying to write this one portion: I need to be able to parse a stream of tokens and push them one by one into a vector, ignoring whitespace and tokenizing special symbols (simple case, lets just consider parentheses and braces) Example: int main(){ ...

Is there an equivalent to 'sscanf()' in .NET?

The .NET Framework gives us the Format method: string s = string.Format("This {0} very {1}.", "is", "funny"); // s is now: "This is very funny." I would like an "Unformat" function, something like: object[] params = string.Unformat("This {0} very {1}.", "This is very funny."); // params is now: ["is", "funny"] I know something simi...

How can I concatenate a String with a Bit (documentTitle+Archive) SQL server 2005

I get the following error when I try to concatenate Operand type clash: text in incompatible with bit Invalid operator for datatype: Operator equals Add, Type equal bit SELECT F.SubmissionId, F.FormId, F.DocumentTitle + F.Archive AS DocumentTitle, F.Keywords, F.PublishDate, F.PostedDate, F.ExpiredDate, F.IsFlag, F.IsAdminOnly,...

How to split a string while preserving line endings?

I have a block of text and I want to get its lines without losing the \r and \n at the end. Right now, I have the following (suboptimal code): string[] lines = tbIn.Text.Split('\n') .Select(t => t.Replace("\r", "\r\n")).ToArray(); So I'm wondering - is there a better way to do it? Accepted answer string[] lines ...

Is there a way to Convert Number words to Integers? Python

I need to convert 'one' into '1' 'two' into '2' and so on. Is there a way to do this a library or a class or anything? ...

How do I write a value to the registry on a Windows Mobile 5 device?

I have a string value that I want to write to the registry as a Dword to read via another program. How can i create a new key/string using c# .net? ...

Are php strings immutable?

Or: Should I optimize my string-operations in PHP? I tried to ask PHP's manual about it, but I didn't get any hints to anything. ...

C++ string to boolean array

I have a ~100 digit string which represents a number in base 10 that I want to convert to either a string representing the number in base 2, or a bool array which represents the number's digits in binary. I can do it easily in Java using BigInteger, but I'm not sure if there is an equivalent in C++. Function would be something like: s...

Extending the String Class With Properties?

I have an application where I need to populate a textbox with a company name and I have filled a custom AutoCompleteStringColection with all the available company names from the database. When a user enters changes the company name by typing and selecting from the list a new company name I need to have the id (Guid), of the selected comp...

"Absolute" string metric

I have a huge (but finite) set of natural language strings. I need a way to convert each string to a numeric value. For any given string the value must be the same every time. The more "different" two given strings are, the more different two corresponding values should be. The more "similar" they are, the less different values should ...

Compare two strings by ignoring certain characters

Hi, I wonder if there is an easy way to check if two strings match by excluding certain characters in the strings. See example below. I can easily write such a method by writing a regular expression to find the "wild card" characters, and replace them with a common character. Then compare the two strings str1 and str2. I am not looking...

Best way to test for existing string against a large list of comparables

Suppose you have a list of acronym's that define a value (ex. AB1,DE2,CC3) and you need to check a string value (ex. "Happy:DE2|234") to see if an acronym is found in the string. For a short list of acronym's I would usually create a simple RegEx that used a separator (ex. (AB1|DE2|CC3) ) and just look for a match. But how would I ta...

.Net: Is String.Contains() faster than String.IndexOf()?

I have a string buffer of about 2000 characters and need to check the buffer if it contains a specific string. Will do the check in a ASP.NET 2.0 webapp for every webrequest. Does anyone know if the String.Contains method performs better than String.IndexOf method? // 2000 characters in s1, search token in s2 string s1 = "Many ...

CSS: how can I force a long string (without any blank) to be wrapped in XUL and/or HTML

I have a long string (a DNA sequence). It does not contain any whitespace character. e.g.: ACTGATCGAGCTGAAGCGCAGTGCGATGCTTCGATGATGCTGACGATGCTACGATGCGAGCATCTACGATCAGTCGATGTAGCTAGTAGCATGTAGTGA what would be the css selector to force this text to be wrapped in an html:textarea or in a xul:textbox Thanks. ...