string

C++ Convert SQLVARCHAR to string

I need to convert from a SQLVARCHAR to a string data type variable definitions as follows: string strFirstName; SQLVARCHAR rtnFirstName[50]; Want to be able to accomplish the following: if (strFirstName.empty()) strFirstName = rtnFirstName; Gives an error that the binary '=': no operator found which takes a right-hand operand of ty...

How do I convert a list of ascii values to a string in python?

I've got a list in a Python program that contains a series of numbers, which are themselves ASCII values. How do I convert this into a "regular" string that I can echo to the screen? ...

CEdit control maximum length? (in characters it can display)

What is the maximum length for the text string contained in a CEdit control in MFC? I get a beep when trying to add a character after the character 30001 is this documented anywhere? Can I display longer texts in a CEdit? Should I use another control? As "Windows programmer" says down below, the text length limit is not the same when th...

Python find() and newlines

While editing someone else's abandoned Python script, I was trying to use mystring.find("\n", i) to get the index of the next newline in a string. But this consistently returns -1 (even when I try using "\r\n" instead of "\n"). I know there are newlines in the string, because I had just loaded it from a file. I am not very familiar wi...

Concatenating arbitrary number of rows of strings in mysql (hierarchical query)

I have a mysql table with albums. Each album can be a top level album, or a child album of another album. Each album has a foldername which is the name of the folder its pictures are in. Each album also has a field called parent which is the id of the parent album. So, if I have a path to an image like this: root/album1/album2/image1.jp...

Remove domain information from login id in C#

I would like to remove the domain/computer information from a login id in C#. So, I would like to make either "Domain\me" or "Domain\me" just "me". I could always check for the existence of either, and use that as the index to start the substring...but I am looking for something more elegant and compact. Worse case scenario: ...

Splitting a semicolon-separated string to a dictionary, in Python

I have a string that looks like this: "Name1=Value1;Name2=Value2;Name3=Value3" Is there a built-in class/function in Python that will take that string and construct a dictionary, as though I had done this: dict = { "Name1": "Value1", "Name2": "Value2", "Name3": "Value3" } I have looked through the modules available but ...

String Operations in Java

I know this is a bit of a newbie question, but are there equivalents to C#'s string operations in Java? Specifically, I'm talking about String.Format and String.Join. ...

Immutable String misunderstanding or a mistake in the Docs?

I've just seen this in the MS Visual Studio docs and the part in bold doesn't make sense to me. Is it wrong or am I not understanding it properly? If you run this, b appears to hold "hello" (as I would expect) and not "h". Strings are immutable--the contents of a string object cannot be changed after the object is created, although the ...

Which Version of StringComparer to use

If I want to have a case-insensitive string-keyed dictionary, which version of StringComparer should I use given these constraints: The keys in the dictionary come from either C# code or config files written in english locale only (either US, or UK) The software is internationalized and will run in different locales I normally use St...

Comparing Two Strings producing a numeric delta

Does anyone know of a simple way to compare two strings together to generate the "amount of difference" between the two? (in a numeric value) I have been crawling google with little luck on this. And after doing some coding it's not as simple as I had thought. Any clues? ...

How to format a string as a telephone number in C#

I have a string "1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable. I was thinking: String.Format("{0:###-###-####}", i["MyPhone"].ToString() ); but that does not seem to do the trick. ** ...

Regex to find lines containing sequence but not containing a different sequence

How do I write a regular expression to find all lines containing 665 and not having .pdf I can't seem to find how to do not in regex. This is for Notepad++ syntax if it matters. Thanks ...

Do I need to worry about the String Constant Pool?

I have a Java application that's very String-heavy - it takes a feed of huge numbers of big, different String objects. Do I need to worry about the String Constant Pool for memory and performance? Is there any way to see how big the pool is at any point? ...

Progress string parsing in C

I have the following character string: "..1....10..20....30...40....50...80..." and I need to extract all numbers from it into array. What is the best way to do it in C? ...

How do I create a string from one row of a two dimensional rectangular character array in C#?

I have a 2 dimensional array, like so: char[,] str = new char[2,50]; Now, after I've stored contents in both str[0] and str[1], how do I store it in a string[] s = new string[2]; ? I tried s[0] = str[0].ToString(); but that seems to be an error: VC# expects 'two' indices within the braces, which means I can convert only a cha...

Adding spaces between strings

Hi, What's the best way of adding spaces between strings myString = string.Concat("a"," ","b") or myString = string.Concat("a",Chr(9),"b") I am using stringbuilder to build an XML file and looking for something efficient. Thanks Edit ~ Language VB.NET ...

How do I use LINQ Contains(string[]) instead of Contains(string)

Hey all. I got one big question. I got a linq query to put it simply looks like this: from xx in table where xx.uid.ToString().Contains(string[]) select xx The values of the string[] array would be numbers like (1,45,20,10,etc...) the Default for .Contains is .Contains(string). I need it to do this instead: .Contains(string[])......

Limit displayed length of string on web page

I'm looking for a technique (javascript, CSS, whatever ???) that will let me control the amount of a string that is displayed. The string is the result of a search (and therefore not initially known). A simple Character count approach is trivial, but not acceptable, as it needs to handle proportional fonts. In otherwords if I want to lim...

PHP: Best way to extract text within parenthesis?

What's the best/most efficient way to extract text set between parenthesis? Say I wanted to get the string "text" from the string "ignore everything except this (text)" in the most efficient manner possible. So far, the best I've come up with is this: $fullString = "ignore everything except this (text)"; $start = strpos('(', $fullStrin...