Tag: string

52 votes
30 answers
2.6K views
How do I convert a String to an int in Java?

How can I convert a String to an int in Java? My String contains only numbers, and I want to return the numbe

avatar
Louetta
0 1 0 9
asked 07 September, 2021
60 votes
18 answers
439 views
Why is char[] preferred over String for passwords?

In Swing, the password field has a getPassword() (returns char[]) method instead of the usual getText() (retur

avatar
Chelsea
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
2K views
How do I read / convert an InputStream into a String in Java?

If you have a java.io.InputStream object, how should you process that object and produce a String? Suppose I

avatar
Margo
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
2.9K views
Creating multiline strings in JavaScript

I have the following code in Ruby. I want to convert this code into JavaScript. What is the equivalent code in

avatar
Royal
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
2.5K views
How do I make the first letter of a string uppercase in JavaScript?

How do I make the first letter of a string uppercase, but not change the case of any of the other letters? For

avatar
Jefferey
0 1 0 9
asked 07 September, 2021
54 votes
30 answers
2.6K views
How to replace all occurrences of a string in JavaScript

I have this string in my JavaScript code: "Test abc test test abc test test test abc test test abc" Doing: st

avatar
Santiago
0 1 0 9
asked 07 September, 2021
59 votes
7 answers
2.3K views
What is the difference between single-quoted and double-quoted strings in PHP?

I'm a little confused why I see some code in PHP with string placed in single quotes and sometimes in dou

avatar
Jeff
0 1 0 9
asked 07 September, 2021
52 votes
27 answers
771 views
Remove empty array elements

Some elements in my array are empty strings based on what the user has submitted. I need to remove those eleme

avatar
Lynette
0 1 0 9
asked 07 September, 2021
52 votes
30 answers
581 views
PHP random string generator

I'm trying to create a randomized string in PHP, and I get absolutely no output with this: <?php

avatar
Janella
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
2.4K views
startsWith() and endsWith() functions in PHP

How can I write two functions that would take a string and return if it starts with the specified character/st

avatar
User demo
0 1 0 9
asked 07 September, 2021