Category "string"

How to get all fuzzy matching substrings between two strings in python?

Say I have three example strings text1 = "Patient has checked in for abdominal pain which started 3 days ago. Patient was prescribed idx 20 mg every 4 hours." t

Simple way to convert time text strings to ints for numeric operation in Qliksense data load editor

TimeTemp displays as such 168@06:43:23AM stationTime displays opening and closing times of service area stations as such 6AM-10AM I’ve separated TimeTemp

tail recursion count, split & get the prefix of a list functions

Language: Scala I'm working on some tail recursion questions in Scala. (GOAL) A function that counts the number of ones in a list. The function takes a list of

Split 600 columns into 2 new columns for each one, with old and new column names in vectors

I want to split 600 columns (listed in a vector) at a delimiter (in this case a /) into 2 new columns for each one (also listed as vectors). I've worked out bas

Calculate length of string object using pointers instead of char arrays

I'm working on an exercise to calculate the length of a string using pointers. Here's the code I've written below: int main() { std::string text = "Hello W

Regex to filter out Datetime time from string

Requirement: I am receiving an email with a template and I need to filter out some text from the email. I am converting all the email body text as a string. ema

I want to convert a string containing letters to a double in matlab [closed]

East_Seed_1="MIA"; East_Seed_8="ATL"; for i=1:7 s=rand; if s<MIA_prob_vs_ATL s=1; I want to create an algorithm that, gi

How can I set one array as a value of another array in PHP? [duplicate]

I have the following array: Array ( [0] => James [1] => Mike [2] => Liam [3] => Shantel [4] => Harry ) Arra

Make String.format("%s", arg) display null-valued arguments differently from "null"

Consider the custom toString() implementation of a bean: @Override public String toString() { String.format("this is %s", this.someField); } This yields

How to format a string in Python source code for improved readability [duplicate]

I'm building a rather long file path, like so: file_path = f"{ENV_VAR}/my_dir/{foo['a']}/{foo['b']}/{bar.date()}/{foo['c']}.json" This is a s

Javascript method to capitalize the first letter of every word and also every word after hyphen or dash

I need a JavaScript method to allows me to convert the first letter of every word in a string to a capital letter like this: mike tyson wayne to Mike Tyson Wayn

Can't remove backslash from string in Python

I want to remove backslash from a string, I tried result.replace('\\','') but nothing changed. Anyone has an idea how I can remove it? result = '[(\'company_ids

Find if two strings are anagrams

Faced this question in an interview, which basically stated Find if the given two strings are anagrams of each other in O(N) time without any extra space I tr

Return a dictionary from multiple line string in swift

I am new to swift. Is there a simple way to convert the following string to dictionary format. Example: input = "Name: Jack\\n Area: Place\\n FavColor: Blue\\n"

How can we extract a next numeric value to a string in python

There is a need that I have a taken a output in a string such as string is "Initial: [818 v1] any other string or words here" and here I want to take 818 from t

Speed up millions of regex replacements in Python 3

I have two lists: a list of about 750K "sentences" (long strings) a list of about 20K "words" that I would like to delete from my 750K sentences So, I have to l

How to remove substring starting with RT and ends with ":"

I have a dataset with a column consisting of tweets. Some tweets are retweets, which start with RT @username: ..... I would like to remove this part of the stri

Check if string exists in list made with data from a csv file

I import data from a csv file and then store it in a list (List<Customer> customers). The data is added to the list by creating and adding objects. The ob

How to write millions of double values into a txt file

I've made a neural network and now I need to save the results of the training process into a local file. In total, there are 7,155,264 values. I've tried with a

Keyword repeated multiple times in context from string in R

I have a dataset (z) with strings which are very long in z$txt. I also have a dictionary (incd) of keywords that need to be identified. In the column z$inc.term