Category "string"

Python: find the start index of a specific word number in a string

I have this string: myString = "Tomorrow will be very very rainy" I would like to get the start index of the word number 5 (very). What I do currently, I do sp

Evaluate String expression in Swift just like javascript eval

I am getting dynamic conditions through API to apply in the application. It could be any logical expression. The task is to run all the condition received in mo

R function to start new line every n words?

I want to create an R function that inserts a "\n" after every n words in a string (where n is an argument). e.g. startstring <- "I like to eat fried potat

Python Convert YYYYMMDD string to YYYY-MM-DD string Without Using Datetime

How can I convert a string such as: '20190501' To a string such as: '2019-05-01' Without first converting to datetime, for example: from datetime import

How to index a text field or make it searchable in MySQL?

I have stored about 7 million biological protein sequences in text field of MySQL table (using InnoDB storage engine and latin1_swedish_ci collation). Sequence

Removing the first occurrence of a string from another string in Python

I am trying to write a function that will remove the first occurrence of a string from another string, like: remove("an", "banana") == "bana" The goal is not t

how shall i call out this function using string format method?

i'm learning Python and have began with Google's Python Automation Beginner course. Idk if i chose it right but im already in week 4 and now have started facing

my compiler gives an error E0393 using a pointer to an incomplete type of the "String" class::Srep" is not allowed in inline functions

I tried to write a custom type from a book, my compiler gives an error E0393 using a pointer to an incomplete type of the "String" class::Srep" is not allowed i

remove consecutive substrings from a string without importing any packages

I want to remove consecutive "a" substrings and replace them with one "a" from a string without importing any packages. For example, I want to get abbccca from

What does this char string related piece of C++ code do?

bool check(const char *text) { char c; while (c = *text++) { if ((c & 0x80) && ((*text) & 0x80)) { return true;

String anagram in Java

i am trying to create a program for string anagram that follows these conditions: method should allow only letters, white space, commas and dots in an anagram.

Faced an error: excess elements in char array initializer during print out of array of strings

I've tryed to print out some array of strings but faced error: excess elements in char array initializer Please make a hint what's worng with this code? Step 1

Concatenate strings with quotation marks separated by commas

I want to write a function that concatenates multiple strings into one one string, but each part is marked with quotation marks and separated by a comma. The fu

How can I join strings within a list in Python? [closed]

I have the following list: values = ['A', 'C', 'B', 'D'] Is there a way I can get it to output the list as the following string? result = 'AC

Given a list of strings, return characters that appear in more than one string

I'm trying to implement a function which receives a variable number of strings and returns characters that appear at least in two strings: test_strings = ["hel

How to use unsafe get a byte slice from a string without memory copy

I have read about "https://github.com/golang/go/issues/25484" about no-copy conversion from []byte to string. I am wondering if there is a way to convert a str

How to keep dollar sign within sed in the bash script?

I am trying to find a way to escape the dollar sign within the sed command in a bash script. I have found here tons of answers that say that you need to put fou

Convert a Python block of code into a single line

Below is the python block code, def compute_hcf(x, y): while(y): x, y = y, x % y return x which I wanted to convert into single line like below, d

CoderByte says all of my testcases are wrong?

I tried coderbyte and looks something is wrong with it. The first challenge is simply to reverse a string. I did this in java: import java.util.*; import java

Javascript: How can I add two strings without converting into numbers?

Given two numbers in string format (eg. '10.23' and '25.69') how can I get their sum without converting the string into numbers? (eg '35.92') I do not want to c