Top "String" questions

A string is a finite sequence of symbols, commonly used for text, though sometimes for arbitrary data.

Array to String PHP?

What is the best method for converting a PHP array into a string? I have the variable $type which is …

php arrays string
How do I remove a substring from the end of a string in Python?

I have the following code: url = 'abcdc.com' print(url.strip('.com')) I expected: abcdc I got: abcd Now …

python string
How to use java.String.format in Scala?

I am trying to use a .format method of a string. But if I place %1, %2, etc. in the string, java.…

java string scala format
Which is the preferred way to concatenate a string in Python?

Since Python's string can't be changed, I was wondering how to concatenate a string more efficiently? I can write like …

python string python-3.x concat
How to extract a substring using regex

I have a string that has two single quotes in it, the ' character. In between the single quotes is …

java regex string text-extraction
How to interpolate variables in strings in JavaScript, without concatenation?

I know in PHP we can do something like this: $hello = "foo"; $my_string = "I pity the $hello"; Output: "I …

javascript string variables string-interpolation
Using Enum values as String literals

What is the best way to use the values stored in an Enum as String literals? For example: public enum …

java string enums
Remove empty strings from a list of strings

I want to remove all empty strings from a list of strings in python. My idea looks like this: while …

python string list
How to split a string with any whitespace chars as delimiters

What regex pattern would need I to pass to java.lang.String.split() to split a String into an Array …

java string whitespace split
Count the number of occurrences of a character in a string in Javascript

I need to count the number of occurrences of a character in a string. For example, suppose my string contains: …

javascript string