string

PHP - How to pass a long unescaped string from one page to another?

I would like to pass a long string to a second page. Normally I pass short strings as variables www.example.php?var=something&var2=somethingelse In this case tho I would like to pass a long sentence to a second page and not have to replace all the white spaces with dashes deal with commas and apostrophes. Is there a simple way to d...

C#: How do I parse a string with a decimal point to a double?

I guess this is a very easy question, but I wasn't able to find a question with Google or the MSDN examples. I want to parse a string like "3.5" to a double. However, double.Parse("3.5") yields 35 and double.Parse("3.5", System.Globalization.NumberStyles.AllowDecimalPoint) (something I tried in my desperation ;) ) which compiles...

Multiple actions on the same controller and view in asp.net MVC

Hello, How do I use multiple actions on the same controller? I'm using the default project that comes up when opening a new project in asp.net mvc. I added one more Index action on the homecontroller to accept a value from a textbox...like this string strTest; [AcceptVerbs(HttpVerbs.Post)] public ActionResult Index(Fo...

C# 3.0 Remove chars from string

I have a string and what to remove all characters except all english letters (a..z) replace all whitespaces sequences with a single whitespace How would you do that with C# 3.0 ? ...

Strings in Erlang - what libraries and techniques should I be examining?

I am working on a project that will require internationalisation support down the track. I want to get started on the right foot with UTF support, and I was wondering what the best practice for handling UTF in Erlang is? From my current research it seems there are a couple of issues with Erlang's built in string handling for some use ca...

locale-dependent ordering for std::string

I am trying to compare std::strings in a locale-dependent manner. For ordinary C-style strings, I've found strcoll, which does exactly what I want, after doing std::setlocale #include <iostream> #include <locale> #include <cstring> bool cmp(const char* a, const char* b) { return strcoll(a, b) < 0; } int main() { const char* s...

Extract decimal separator

Hello Everybody: I'm importing a csv file in C#, sometimes with '.', sometimes with ',' as decimal separator. Is there a best way of determinate the decimal separator better than counting from the last char down to the first apperance? Thanks in advance. Franklin Albricias. ...

How does String.CompareTo work?

When I compare strings containing positive/negative numbers, for example: int res1 = "-1".CompareTo("1"); int res2 = "-1".CompareTo("2"); res1 equals 1. res2 equals -1. How does String.CompareTo work?? That would mean it is order is "2 -1 1"... ...

How to get adress of a Java Object?

Is there a way to get address of a Java object? Where the question comes from?: At First, I read properties file and all the data from file was placed into table. Properties file can update. So, I want to listen that file. I listen an object using PropertyChangeSupport and PropertyChangeListener. updatedStatus = new basit.data.MyStri...

combine join with String.Contains in Linq query

i have the following linq query that create a left join between two tables: var joinResultRows = from leftTable in dataSet.Tables[leftTableName].AsEnumerable() join rightTable in dataSet.Tables[rightTableName].AsEnumerable() on...

htmlentities in PHP but preserving html tags

Hi there, I want to convert all texts in a string into html entities but preserving the HTML tags, for example this: <p><font style="color:#FF0000">Camión español</font></p> should be translated into this: <p><font style="color:#FF0000">Cami&oacute;n espa&ntilde;ol</font></p> any ideas? ...

What are all the escape characters in Java?

I know some of the escape characters in Java, e.g. \n : Newline \r : Carriage return \t : Tab \\ : Backslash ... Is there a complete list somewhere? ...

ostringstream and ends

I've been working with somebody else's code and noticed that on all uses of ostringsteam they are in the habit of explicitly appending std::ends. This is something I've never done and have never encountered a problem. It doesn't appear to, but should std::ends make any difference in the following code? ostringstream message; message <...

Is there a faster way to escape a string?

I have a method that looks like this: public static String escape(String text) { String r = replace(text, "\\", "\\\\"); r = replace(r, "\r", "\\r"); r = replace(r, "\b", "\\b"); r = replace(r, "\t", "\\t"); r = replace(r, "\n", "\\n"); r = replace(r, "\f", "\\f"); return r; } Is there a faster, less brutal way to...

Substring algorithm

Can someone explain to me how to solve the substring problem iteratively? The problem: given two strings S=S1S2S3…Sn and T=T1T2T3…Tm, with m is less than or equal to n, determine if T is a substring of S. ...

Whats the difference between "abc" and {"abc"} in C?

In C specifically (i suppose this also applies to C++), what is the difference between char str[4] = "abc"; char *cstr = {"abc"}; Problems arise when i try and pass my "abc" into a function that accepts char** void f(char** s) { fprintf(stderr, "%s", *s); } Doing the following yields a compiler error. If cast to char** (to make c...

C++ string in classes

I know this is quite a ridiculous question but this is quite confusing and irritating, as something that should work simply is not. I'm using Code Blocks with the GCC compiler and I am trying to simply create a string variable in my class #ifndef ALIEN_LANGUAGE #define ALIEN_LANGUAGE #include <string> class Language { public: ...

PHP - Displaying page that uses query string, but without any variable

I have a page called Error.php. Variables are usually passed to it using the query string so that it will display the corresponding message to the error code I have assigned. Example: Error.php?id=1 Here is the section of my page below: <?php if($_GET["id"] == "0") { echo "Display certain information..."; } elseif($_GET["id"] == "...

C# IEnumerable<Object> to string

Hi, For log purpose, I would like to call the .ToString() method of every object on an object[] array. How can I do this in the simpliest way ? Say I have : myArray = new Object[]{"astring",1, Customer} Log(????); How can I pass un string such as its value is equals to "astring".ToString()+1.ToString()+Customer.ToString() Or bette...

How to convert a String into an array of Strings containing one character each

I have a small problem here.I need to convert a string read from console into each character of string. For example string: "aabbab" I want to this string into array of string.How would I do that? ...