Top "String" questions

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

How to check whether a string contains a substring in JavaScript?

Usually I would expect a String.contains() method, but there doesn't seem to be one. What is a reasonable way …

javascript string substring string-matching
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 …

java string int type-conversion
How do I check if a string contains a specific word?

Consider: $a = 'How are you?'; if ($a contains 'are') echo 'true'; Suppose I have the code above, what is …

php string substring contains string-matching
Does Python have a string 'contains' substring method?

I'm looking for a string.contains or string.indexof method in Python. I want to do: if not somestring.contains("…

python string substring contains
How to split a string in Java

I have a string, "004-034556", that I want to split into two strings: string1="004"; string2="034556"; That means the first string …

java string split
How do I compare strings in Java?

I've been using the == operator in my program to compare all my strings so far. However, I ran into a …

java string equality
How to read a file line-by-line into a list?

How do I read every line of a file in Python and store each line as an element in a …

python string file readlines
How to replace all occurrences of a string?

I have this string: "Test abc test test abc test test test abc test test abc" Doing: str = str.replace(…

javascript string replace
Converting integer to string in Python

I want to convert an integer to a string in Python. I am typecasting it in vain: d = 15 d.str() …

python string integer
Easiest way to convert int to string in C++

What is the easiest way to convert from int to equivalent string in C++. I am aware of two methods. …

c++ string int type-conversion