I just answered a question where I said that while string interning is good it can be a security problem since a strings value can be easily accessed later on.
And while I'm quite sure this is true :-) I am not sure how easy it really is. I tried googling the topic but I got no relevant results (the google-fu is weak in this one), so t...
Is there a built-in IsLowerCase() in .NET?
...
I always seem to see if a string (querystring value usually) has a value but first I have to check that it is not nothing first so I end up with 2 if then statements - am I missing somethign here - there has to be a better way to do this:
If Not String.IsNullOrEmpty(myString) Then
If CBool(myString) Then
//code
End If
End If
...
While looking at online code samples, I have sometimes come across an assignment of a String constant to a String object via the use of the new operator.
For example:
String s;
...
s = new String("Hello World");
This, of course, compared to
s = "Hello World";
I'm not familiar with this syntax and have no idea what the purpose or e...
I need to modify my program to accept Unicode, which may come from any of UTF-8 and the various UTF-16 and UTF-32 encodings. I don't really know much about Unicode (though I've read Joel Spolsky's article and the Wikipedia page).
Right now I'm using an std::istream and reading my input char by char, and then storing (when necessary) in...
I have three values I need to align in a dropdown box. How can I do this? I've been trying this:
String.Format("{0,-30}{1,-15}{2,-10}{3,-8}", new object[] { cusJob, service, username, time });
But that leaves it uneven because it's not a monospaced font. I don't really want to use a monospaced font and I've seen applications align it b...
I can't find anything other than closed-source web applications. Are there any active projects? I'd be interested in using the software in something I'm developing and getting involved.
...
When I reading source code of Beast, I found a lot of code like this:
<%= 'Password'[:password_title] %>
It seems like a call to [] method with Symbol as input parameter to a String to me, but I didn't find such type of parameter of String [] method in the ruby API. What is this means?
thanks in advance.
...
I need to pull large Unicode textual strings (e.g. 200Mb) from a Database (nvarchar) and store in memory for processing. i.e. I need random access to all parts of the strings.
Looking at this from strictly memory centric point of view, what are the pro’s and con’s of using a System.IO.MemoryStream versus a System.String as my in memory ...
I naively imagined that I could build a suffix trie where I keep a visit-count for each node, and then the deepest nodes with counts greater than one are the result set I'm looking for.
I have a really really long string (hundreds of megabytes). I have about 1 GB of RAM.
This is why building a suffix trie with counting data is too ine...
Let's say that I have written a custom e-mail management application for the company that I work for. It reads e-mails from the company's support account and stores cleaned-up, plain text versions of them in a database, doing other neat things like associating it with customer accounts and orders in the process. When an employee replies ...
What exactly is a "Format String Vulnerability" in a Windows System, how does it work, and how can I protect against it?
...
How do you determine the length of a string of text in Arial Bold font, and then center it in VB6?
If not here, can you point me in a direction where I might be able to find this information?
We're not using a "label" or "picture box" do print the text to the screen. We are sizing the text on the fly, and allowing the user to scale the...
I am not able to understand the differences between std::string and std::wstring. I know wstring supports wide characters such as Unicode characters. I have got the following questions:
When should I use std::wstring over std::string?
Can std::string hold the entire ASCII character set, including the special characters?
Is std::wstring...
Why does the following code NOT give an error, nor any type of a warning about an implicit conversion?
std::wstring str = L"hi";
if(str[0] == 'h')
cout<<"strange"<<endl;
The proper normal code is:
std::wstring str = L"hi";
if(str[0] == L'h')
cout<<"strange"<<endl;
Compiler: visual studio 2005
Warning level: level 4 (hi...
Is there any better alternative for doing string formatting in VC6, with syntax checking before substitution?
...
I'm getting a "FormatException: Input string was not in a correct format" error that I don't understand.
I'm using the following lines to write a string to a text file:
using (StreamWriter sw = new StreamWriter(myfilename, false, System.Text.Encoding.GetEncoding(enc)))
{
sw.Write(mystring, Environment.NewLine);
}
(the encoding p...
How can you check whether a string is convertible to an int?
Lets say we have data like "House", "50", "Dog", "45.99", I want to know whether I should just use the string or use the parsed int value instead.
In Javascript we had this parseInt() function, if the string couldn't be parsed, it would get back NaN.
...
When doing a simple performance measurement, I was astonished to see that calling String.IndexOf(char) was actually slower than doing it manually! Is this really true?! Here is my test code:
const string str = @"91023m lkajsdfl;jkasdf;piou-09324\\adf \asdf\45\ 65u\ 86\ 8\\\;";
static int testIndexOf() { return str.IndexOf('\\'); }
stati...
Exactly that: Does a strings length equal the byte size? Does it matter on the language?
I think it is, but I just want to make sure.
Additional Info: I'm just wondering in general. My specific situation was PHP with MySQL.
As the answer is no, that's all I need know.
...