Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Monday, June 11, 2012

Get an OutputStream into a String


What's the best way to pipe the output from an java.io.OutputStream to a String in Java?

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

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)

JavaScript: string contains


How can I check if one string contains another substring in JavaScript?

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)

Monday, May 21, 2012

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: