Top "String" questions

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

Check if a Python list item contains a string inside another string

I have a list: my_list = ['abc-123', 'def-456', 'ghi-789', 'abc-456'] and want to search for items …

python string
TypeError: a bytes-like object is required, not 'str' when writing to a file in Python3

I've very recently migrated to Py 3.5. This code was working properly in Python 2.7: with open(fname, 'rb') as f: lines = […

python python-3.x string file byte
How to get the filename without the extension from a path in Python?

How to get the filename without the extension from a path in Python? For instance, if I had "/path/to/…

python string path
How to add new elements to an array?

I have the following code: String[] where; where.append(ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1"); where.append(ContactsContract.Contacts.IN_VISIBLE_…

java arrays string
Extract substring in Bash

Given a filename in the form someletters_12345_moreleters.ext, I want to extract the 5 digits and put them into a …

string bash shell substring
Print string to text file

I'm using Python to open a text document: text_file = open("Output.txt", "w") text_file.write("Purchase Amount: " 'TotalAmount') …

python string text file-io
In Java, how do I check if a string contains a substring (ignoring case)?

I have two Strings, str1 and str2. How do I check if str2 is contained within str1, ignoring case?

java string substring
How to concatenate items in a list to a single string?

Is there a simpler way to concatenate string items in a list into a single string? Can I use the …

python string list concatenation
Converting an integer to a string in PHP

Is there a way to convert an integer to a string in PHP?

php string casting type-conversion integer
How to compare strings in Bash

How do I compare a variable to a string (and do something if they match)?

string bash