Category "string"

How to subtract char out from string in c++?

Hello I want to know how to subract string from string For example If string s = "124ab" I can easily extract integer by using sstream but I don't know how to e

numpy where with multiple conditions linked to dataframe

I'm using numpy where with multiple conditions to assign a category based on a text string a transaction description. Part of the code is below `import numpy as

Generate variable name with string and value in Lua

Is there a function in Lua to generate a variable name with a string and a value? For example, I have the first (string) part "vari" and the second (value) part

Convert React/javascript string array of objects to array of objects

This seems like a trivial issues but I can't get it working properly. I'm fairly new to JS/React so that is working against me also. This is the response I get

How to capture the field values in the csv file using bufferedreader

The csv file looks like this I'm trying to get the field values like name, it is the value after $$NAME$$ (there is a space after the identifier). How do I st

How to remove extra space in template literals?

When I create template literals, I would use the trim() to remove extra space. But I noticed when I do this inside a JS function, it still creates extra tabs or

Converting windows paths to pathlib.WindowsPath() within a function in python

Edited for clarity I need to be able to copy and paste a windows path directly from file explorer into a function which turns it into a pathlib.WindowsPath() ob

str_detect removing some but not all strings with specified ending

I'd like to remove any string that ends in either of 2 characters in a pipe. In this example it's ".o" or ".t". Some of them get removed, but not all of them, a

Retrieve array of substring matched with regex in swift

Is there any way to retrieve an array of words prefixed with @ sign in a string? "@City == xyz AND @Hobby == gardening" -> ["@City","@Hobby"] I tried below

Given a rectangular matrix of characters, add a border of asterisks(*) to it

Example For picture = ["abc", "ded"] the output should be addBorder(picture) = ["*****", "*abc*", "*ded*

Change position of a line with a specific string, using python

I am new to coding, trying to find a simple python code for re-arranging some lines. Lines have specific string to select. Those lines with this specific string

sed replacing first occurence of characters in each line of file only if they are first 2 characters

Is it possible using sed to replace the first occurrence of a character or substring in line of file only if it is the first 2 characters in the line? For examp

string column conversion to float in Pandas DataFrame

I want to get left value (LD) pipe separated value from the DataFrame column "'CA Distance Nominal (LD | au)" here is the code. when I convert the string to flo

Replacing characters from string in python list

I have a list of names of apple products in random format. like take a single product name iphone 11 pro which can be found Iphone 11 Pro or iphone 11 Pro, or a

The most common letter in a string (Python)

I have an exercise to find the most common letter in a string, excluding punctuation symbols, digits and whitespaces and the result should be in lowercase "A"==

Nested if statement is only executing first part

What I want my code to do I want my code to validate user input without using Regex or isDigit operators. If all the requirements of the if statements are found

Printing string range in Python

s ="XII" roman = {"I":1, "IV":4, "V":5, "IX":9, "X":10, "XL":40, "L":50, "XC":90, "C":100, "CD":400, "D":500, "CM":900, "M":1000} out = 0 n =

How do I force a blank for rows in a dataframe that have any str or character apart from numerics?

I have a datframe >temp Age Rank PhoneNumber State City 10 1 99-22344-1 Ga abc 15 12 No Ma xyz For the column(Phone Numbe

How can I truncate a line of text longer than a given length?

How would you go about removing everything after x number of characters? For example, cut everything after 15 characters and add ... to it. This is an example s

R incongruity when copying a column in R with ifelse

After loading lots of xlsx sheets of multiple workbooks, I want to create a double check of the tidiness and cleanliness of the data source. I created a data fr