In .NET, what is the difference between String.Empty and "", and are they interchangable, or is there some underlying reference or Localization issues around equality that String.Empty will ensure are not a problem?
...
I would like to do some condition formatting of strings. I know that you can do some conditional formatting of integers and floats as follows:
Int32 i = 0;
i.ToString("$#,##0.00;($#,##0.00);Zero");
The above code would result in one of three formats if the variable is positive, negative, or zero.
I would like to know if there is any...
How can I convert a JavaScript string value to be in all lower case letters?
Example: "Your Name" to "your name".
...
I have a function in a native DLL defined as follows:
#include <string>
void SetPath(string path);
I tried to put this in Microsoft's P/Invoke Interop Assistant, but it chokes on the "string" class (which I think is from MFC?).
I have tried marshaling it as a variety of different types (C# String, char[], byte[]) but every time I eit...
I have a rather big number of source files that I need parse and extract all string literals and put them in a file as play old java constant. For exemple:
Label l = new Label("Cat");
Would become:
Label l = new Label(Constants.CAT);
And in Constants.java I would have:
public final static String CAT = "Cat";
I do not want the strin...
I'm trying to generate some code at runtime where I put in some boiler-plate stuff and the user is allowed to enter the actual working code. My boiler-plate code looks something like this:
using System;
public class ClassName
{
public double TheFunction(double input)
{
// user entered code here
}
}
Ideally, I thi...
Hi,
I'd like to invoke bash using a string as input. Something like:
sh -l -c "./foo"
I'd like to do this from Java. Unfortunately, when I try to invoke the command using getRuntime().exec, I get the following error:
foo": -c: line 0: unexpected EOF while looking for matching `"'
foo": -c: line 1: syntax error: unexp...
Hello,
I want to get input from an amount of integers,but after it get input to a string with getline(cin,stringname);
But the enter that the user gives when he input numbers to the ints,gets into the string and it doesn't get any input(sentence) to the string,only the "enter" key.
how can I solve that?
Thanks.
...
Hi, in a C program I have an long* that I want to serialize (thus converting to chars). A long doesn't fit in a single char, and the size varies depending of the processor (can be 4 bytes or 8 bytes).
Theres a good way to make the serialization and de-serialization?
...
In the quest for localization I need to find all the string literals littered amongst our source code. I was looking for a way to script this into a post-modification source repository check. (I.E. after some one checks something in have a box setup to check this stat) I'll probably use NAnt and CruiseControl or something to handle the m...
In Java, suppose I have a String variable S, and I want to search for it inside of another String T, like so:
if (T.matches(S)) ...
(note: the above line was T.contains() until a few posts pointed out that that method does not use regexes. My bad.)
But now suppose S may have unsavory characters in it. For instance, let S = "[hi"...
Hi All,
I'm getting an unexpected T_CONCAT_EQUAL error on a line of the following form:
$arg1 .= "arg2".$arg3."arg4";
I'm using PHP5. I could simply go an do the following:
$arg1 = $arg1."arg2".$arg3."arg4";
but I'd like to know whats going wrong in the first place. Any ideas?
Thanks,
sweeney
...
I'm writing a function that gets the path environment variable of a system, splits up each path, then concats on some other extra characters onto the end of each path.
Everything works fine until I use the strcat() function (see code below).
char* prependPath( char* exeName )
{
char* path = getenv("PATH");
char* pathDeepCopy ...
How to I get the Fixnum returned by the following:
"abc"[2]
Back into a character?
...
When maintaining a COM interface should an empty BSTR be treated the same way as NULL?
In other words should these two function calls produce the same result?
// Empty BSTR
CComBSTR empty(L""); // Or SysAllocString(L"")
someObj->Foo(empty);
// NULL BSTR
someObj->Foo(NULL);
...
I'm trying to output a list of string values into a 2 column format. The standard way of making a list of strings into "normal text" is by using the string.join method. However, it only takes 2 arguments so I can only make a single column using "\n". I thought trying to make a loop that would simply add a tab between columns would do it ...
I've managed to mostly ignore all this multi-byte character stuff, but now I need to do some UI work and I know my ignorance in this area is going to catch up with me! Can anyone explain in a few paragraphs or less just what I need to know so that I can localize my applications? What types should I be using (I use both .Net and C/C++, an...
I have a multi-line string literal that I want to do an operation on each line, like so.
inputString = """Line 1
Line 2
Line 3"""
I want to do something like the following.
for line in inputString:
doStuff()
...
Hi
I would like to format a J2ME Date object to only show the date part, not the date and time. What would be the easiest way? Would probably need to include an external library to do this. Any suggestions?
Kind regards,
IanG
...
What is the simplest way (least error-prone, least lines of code, however you want to interpret it) to open a file in C and read its contents into a string (char*, char[], whatever)?
...