What's the best way to pipe the output from an java.io.OutputStream to a String in Java?
Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Monday, June 11, 2012
Get an OutputStream into a String
Tuesday, June 5, 2012
How to escape brackets in a format string in .Net
How can brackets be escaped in a C# format string so, something like :
How do I compare strings in objective c?
I want to compare the value of an NSString to the string "Wrong". Here is my code:
Friday, June 1, 2012
String contains string in objective-c
How can I check if a string (NSString) contains another smaller string? I was hoping for something like:
CharSequence VS String in Java?
Programming in Android, most of the text values are expected in CharSequence.
Capitalize the first letter of string in JavaScript
I want to capitalize the first character of a string, but not change the case of any of the other letters. For example:
Thursday, May 31, 2012
Convert JavaScript String to be all lower case?
How can I convert a JavaScript string value to be in all lower case letters?
Friday, May 25, 2012
In Java, how do I read/convert an InputStream to a String?
If you have java.io.InputStream
object, how should you process that object and produce a String
?
What is the difference between String and string
In C#, what is the difference between String
and string
? (note the case)
Why is char[] preferred over string for passwords?
In Swing , the password field has a getPassword()
(returns char[]
) method instead of the usual getText()
(returns String
) method. Similarly, I have come across a suggestion not to use String
s to handle passwords. Why does String
pose a threat to security when it comes to passwords?
What is the difference between String and string
In C#, what is the difference between String
and string
? (note the case)
Wednesday, May 23, 2012
Is the Contains Method in java.lang.String Case-sensitive?
Say I have 2 strings,
String s1 = "AbBaCca";
String s2 = "bac";
Monday, May 21, 2012
.NET String to byte Array C#
How do I convert a string
to a byte
array in .NET (C#)?
Most efficient way to get next letter in the alphabet using PHP
Given any character from a to z, what is the most efficient way to get the next letter in the alphabet using PHP?
Sunday, May 20, 2012
.htaccess with products (string)
i use .htaccess and i have a rule that allow me to dynamically look for product in my database.
Friday, May 18, 2012
If strings are immutable in .NET, then why does Substring take O(n) time?
Given that strings are immutable in .NET, I'm wondering why they have been designed such that string.Substring()
takes O( substring.Length
) time, instead of O(1)?
Thursday, May 10, 2012
Can anyone explain this bizarre JS behavior concerning string concatenation?
I just posted this to a gist: https://gist.github.com/2228570
var out = '';
function doWhat(){
out += '<li>';
console.log(out === '<li>'); // at this point, out will equal '<li>'
return '';
}
out += doWhat();
console.log(out, out === '<li>');
// I expect out to == '<li>', but it's actually an empty string!?
When to use strtr vs str_replace?
I'm having a hard time understanding when strtr
would be preferable to str_replace
or vice versa. It seems that it's possible to achieve the exact same results using either function, although the order in which substrings are replaced is reversed. For example:
Tuesday, May 1, 2012
Replace multiple characters in a string in Objective-C?
In PHP I can do this:
$new = str_replace(array('/', ':', '.'), '', $new);