Category "string"

How can I dynamically split the text based on multiple sub-titles in a given text for every new text?

I have an original text that looks like this: We are AMS. We are a global total workforce solutions firm; we enable organisations to thrive in an age of constan

Keep k random strings from input file of unknown length in C

Problem I want to get input from a file of unknown length, separating the input to strings at a defined delimiter and saving some of them. After reading the ent

How I am supposed to get a random string output from an object in JS? [duplicate]

I need help with the following problem: How is it possible to extract a random value from the object below? const hellos = { English: "Hello",

How can I convert a string to dictionary in a manner where I have to extract key and value from same string

I need to convert string to dictionary in a manner for example str1 = "00001000-0009efff : a 00100000-656b2fff : b" Output what I require is dict1 = {'a':['000

C program to remove consecutive repeated characters from string

The code: https://pastebin.com/nW6A49ck /* C program to remove consecutive repeated characters from string. */ #include <stdio.h> int main() { cha

list of strings exist within a list of dict keys?

I have a list of strings: ignore_list = ["new job", "encountered error", "SLA"] and a list of dictionaries: ticket_list = [{"Title": "new job to action", "Leve

Find nth occurrence of a character in a row and replace it in Python, in order to fix/replace a wrong/leftover ";" separator in a text file

I would like to import a text file, with 14 columns with the symbol ";" as a column separator. So, if we have 14 columns, it means we'll find 13 ";" separators

Convert JS object to JSON string

If I defined an object in JS with: var j={"name":"binchen"}; How can I convert the object to JSON? The output string should be: '{"name":"binchen"}'

Check if list of string contains exact part of string

I have a List of strings as follows, List<string> str = new List<string>() { "7, 31", "2, 4", "5, 6" }; My input will be something like "1, 2" or

How can I define custom operators to deal with Range of String.Index in Swift?

I find using String.Index really needs a lot of code in Swift, especially when it comes to methods of Range Swift doesn't have. Like in above code where I don't

How can I avoid control character interpretation in Javascript template string interpolation?

I have a string variable containing a control character (newline). I want to output that variable but with the control character as its literal representation a

Leetcode Reverse String problem not accepting in-place solution

I am posting two solutions below which I tried in leetcode for the problem no : 344 https://leetcode.com/problems/reverse-string/ Solution 1 class Solution: def

What are the best practices to display hardcoded pre-made long texts in an xcode project?

This will soon be my first time publishing an iOS app, and I just finished writing my privacy policy and terms & conditions texts. Best idea I came up with

How to compress a string consisting of only integers and two characters quickly?

I'm trying to implement custom images in Roblox I'm using method of importing and applying the colors of each pixel, but if I don't compress it, the memory is t

How to change 1.3445 to 13445, 2.4444 to 24444 , and keep 1.20 not change

How to change 1.3445 to 13445, 2.4444 to 24444 , and keep 1.20 not change. Thanks! md <- data.frame(value=c('1.3445','1.20','2.4444'))

error: request for member is of non-class type string & char

this is my Node Structure; class Node { public: string data; Node *next; Node *child; }; Node * createList(string *arr, int n) { Node *head = NU

How to set SharePoint path using a string variable on sheet

Dim path as String dim a as string dim b as string a = range("A4") // variable name in cell b = range("A106") // variable of other name in cell Workbooks.Open

Get rid of single quotes from the substituted string within sed command in Python

I have a text file 1.txt which has following content: module abc I am trying to generate multi-line string that I need to add before module abc line in 1.txt.

Reverse words in a string in C++ [duplicate]

Can anyone please tell that why the below written code isnt working , theres no error but its simply printing the string which was passed and

Simplify Path directory problem with stack

I need to implement a function to simplify the path of a directory for example "/home//foo/" need to be "/home/foo", i need to delete all the duplicate slashes