Category "string"

Python how to add create blocks from multiline text

I have the textblock below and I am trying to separate into 3 blocks with regex. When you see the name field it would start a new block. How can I return all

How to print strings and integers in the same line?

I'm trying to print each item in the following two lists: lNames = ['John','David','Michael'] lAges = [45,14,32] with the format: "Person 0, Name: John, Age 3

Program to find if a string is a palindrome keeps on failing. Even after using toLowerCase() command for both strings, output doesn't come

import java.util.Scanner; class Palindrome_string { public static void main() { System.out.println("\f"); Scanner sc = new Scanner(Syste

Convert into DateTime format ISO8601

I am receiving the input date as below. 2022-05-05 18:08:13.311951 +0:00 And I am trying to convert this to below format which follows ISO8601 format. 2022-05-

How to check if values in first dataframe are contained or match values in another dataframe

I am using R to work with some dataframes. My issue is related on how to check if values in a variable in a first dataframe match with values in another datafra

I need to modify (the lower case method ) to support the letter Arabic language

How can I modify or replace the .lower method of strings to support Arabic text? for example, there's a difference between "سارة" and "&

RegExp Match all text parts except given words

I have a text and I need to match all text parts except given words with regexp For example if text is ' Something went wrong and I could not do any

Duplicate Encoder JavaScript, try to use indexOf but the output is still incorect

convert a string to a new string where each character in the new string is "(" if that character appears only once in the original string, or ")" if that charac

How do I create a Java string from the contents of a file?

I've been using the idiom below for some time now. And it seems to be the most wide-spread, at least on the sites I've visited. Is there a better/different way

When using the substr() string function, Why is a litteral carriage return twice as long as a line feed character "\n"?

When typing the following code ... (easily testable with W3schools' editor) <?php $basecss = '.class { margin-bottom:0 } /*1234567890'; $basemincss = ".

Need advice to structure and modify a JSON-payload in Java

Here is a simplified JSON payload that I want to be able to change (the original one is much longer) { "request": { "jsonRequest": { "Alpha": {

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