string

wpf string formatting NOT numbers or dates

This should have a simple solution, but I can't seem to find it. I want to do something like the following, where I have a data binding with a string format. The field is a text field, and I'd like to display it with a suffix (but not change the underlying data). <Label Name="field" Content="{Binding obj.field, StringFormat=\{0\} suff...

Accessing the same string(StringBuilder) using multi-thread.

Hi, My problem is if I use multi-thread on the same string sometime the string won't get replace.(I wrote this on notepad so syntax may be wrong) using System.Thread ... Others ofcourse class .... { private static StringBuild container = new StringBuilder(); static void Main(...) { container.Append(Read From File(K...

Using My.Settings to save an array in VB

How do you save an array or an arraylist in vb.net using My.Settings? I cannot find the array type anywhere, even in the browse window. I absolutely need to be able to save this. I know I can convert the array to a string, but I do not know how to convert a string to an array. I know that if I were to break it at a delimiter then I c...

Javascript string separated by a comma

I'm trying to get everything before/after a comma from a string var test = 'hello,world'; Result: var one = 'hello'; var two = 'world'; What would be a good way to this? Thanks ...

Binary String to Integer

Hello, I have a binary string, entered by the user, which I need to convert to an integer. At first I naivly used this simple line: Convert.ToInt32("11011",2); Unfortunately this throws an exception if the user enters the integer directly. Convert.ToInt32("123",2); // throws Exception How can I make sure that the string entered b...

How do i replace accents (german) in .NET

Hi Friends, I need to replace accents in the string to their english equivalents for example ä = ae ö = oe Ö = Oe ü = ue I know to strip of them from string but i was unaware about replacement. Please let me know if you have some suggestions. I am coding in C# ...

Dispose on String^ in CLI?

I have a small memory leak in my code regarding Strings in CLI/C++. I've tried to fix the leak by deleting my unsigned char array, but when I do, I get a Memory Access Violation. I assume this is because the System::String is a ref type, and because of that, the memory is associated with both 'testString' and 'uch' in the code below....

Given the string "268179", is there any built in methods that could change this to 2.68 in C#

Looking to convert this to a string value of 2.68. I have a way to parse it out but was wondering if there was some built in functionality in the framework to do this. ...

What is the Visual Basic (VB) equivalent of \ in C#?

In C# you can use \ to ignore the special characters: string myString = "this is a \" string"; that would work as one complete string... in VB, doing that does not work... Anyone know the equivalent of \ to ignore special characters for VB? ...

How do I read special characters from a file?

In C#, I am reading insert SQL statements from a text file and then trying to execute them on a database using ADO.NET. Several of the queries include a greek character in one of the columns. Specifically, Mu (funky looking u) that is used for microseconds (usec). The problem is that question marks are actually being inserted into the...

How can I create an unique random sequence of characters in C#?

I'm implementing a URL shortening feature in my application in order to provide my users shorter alternative URLs that can be used in Twitter. The point is to be independent from the shortening services that offer this same service and include it as a feature of my web app. What's the best way to create an unique random sequence of char...

How to deal with special characters in a string

I have a php script creating an encoded value, for example: m>^æ–S[J¯vÖ_ÕÚuÍÔ'´äœÈ‘ ®@M©t²#÷[Éå¹UçfU5T°äÙ“©”ˆÇVÝ] [’e™a«Ã°7#dÉJ> I then need to decode this in a vb.net application The problem is that value above can have any characters. And VB.net can't handle it: dim strCryptedString As String = 'm>^æ–S[J¯vÖ_ÕÚuÍÔ'´äœÈ‘ ®@M©t²#÷[É...

Why does BOOST_FOREACH not work sometimes with C++ strings?

I am using BOOST_FOREACH to iterate through the characters of a C++ string like this: void foobar(const string& str) { BOOST_FOREACH(const char ch, str) { // Do something with ch } return; } This piece of code works fine with the following compilation modes: Multi-threaded (Release) (/MT) Multi-threaded Debu...

Stripping everything but alphanumeric chars from a string in Python

What is the best way to strip all non alphanumeric characters from a string, using Python? The solutions presented in the PHP variant of this question will probably work with some minor adjustments, but don't seem very 'pythonic' to me. For the record, I don't just want to strip periods and commas (and other punctuation), but also quo...

Extracting custom tags from text file

Hello, I am creating my own file tagging system for an application and have not found any relevant information on the subject. My application appends tags to the end of a specified file, like so: If the user wants to mark a particular file as private (for example), the following text will be appended to the end of the specified file: ...

strtok and function call

I have this extremely strange behavior coming : In the below code: If I comment the call to MyLogger then everything works fine that is I get the sTempNr tokenized and 4 tokens are printed . But if I uncomment the call to MyLogger for logging then only the iteration takes place once and in other testing class with similar code as below ...

Should I set the initial java String values from null to ""?

Often I have a class as such: public class Foo { private String field1; private String field2; // etc etc etc } This makes the initial values of field1 and field2 equal to null. Would it be better to have all my String class fields as follows? public class Foo { private String field1 = ""; private String field2 = ""; // etc etc et...

Should I generate XML as a string in C#?

When generating XML in C#, Is there a problem with generating it as a string? In the past I've found generating XML programatically very verbose and convoluted. Creating the xml through string concatenation/a string builder seems much easier but, it feels like bad practice. Should I generate XML as a string? ...

C# code wont compile. No implicit conversion between null and int

Possible Duplicate: Nullable types and the ternary operator. Why wont this work? Why doesn't this work? Seems like valid code. Can anyone help? string cert = ddCovCert.SelectedValue; int? x = (string.IsNullOrEmpty(cert)) ? null: int.Parse(cert); Display(x); How should I code this? The method takes a Nullable. If the dro...

strange behaviour on php

Can some one please tell me why I get odd results rurning the following code? <?php class Bank { var $ID; var $balance; var $name; function bank($name,$id,$balance=0) { $this->ID=$id; $this->balance=$balance; $this->name=$name; } function getBalance() { return $this->balance; } ...