Category "string"

F String With Special Characters

I want to print the following using an f string literal. It will be running wihtin a function and apples will be one of the arguments. I want it to have the squ

Regular Expression to search longest word in a string

I have a string: var str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit"; Is there a way to find the longest word in a string using regex? This w

Convert a mat-datepicker into a String

I'm trying to have a reactive form in which there is some dates that are entered by the user using mat-datepicker. The problem I face is that the output of the

String iterator in swift

I try to create an iterator for string processing in swift that will return every time the next chracter. But with no luck. (The final goal is to write a parser

Leetcode word ladder : How is this solution most efficient?

I'm doing this question in Leetcode : https://leetcode.com/problems/word-ladder/ My solution was a BFA approach, and only one nested loop: def ladderLength(self

Unicode to Arabic Win1256

I have Unicodes in my Database which were encoded from Arabic and I need some source code to convert it to actual Arabic. I have tried a lot of codes but not wo

Check if a permutation of a string can become a palindrome

Write a method to test if a string meets the preconditions to become a palindrome. Eg: Input | Output mmo | True yakak | True travel |

Valid Braces - CodeWars Challenge

There is a challenge on codewars that asks you to check whether a string of parentheses, brackets, and curly braces is valid. A string of braces is consider

Valid Braces - CodeWars Challenge

There is a challenge on codewars that asks you to check whether a string of parentheses, brackets, and curly braces is valid. A string of braces is consider

Sending string using i2c commuication on two arduino micro-controller

i am using two arduino mcu to connect two lines of LED-matrix display. I tried using i2c communication to connect a master mcu (which controls the first line of

pandas dataframe replace blanks with NaN

I have a dataframe with empty cells and would like to replace these empty cells with NaN. A solution previously proposed at this forum works, but only if the ce

Why does this function that removes the first occurrence of a string from another string not work correctly?

I tried to write a function that removes the first occurrence of a string from another string: def removesubstr(substr, x): a = len(substr) m = "" c

Sorting an array of strings in C++

I am trying to accomplish the following task: List the students in alphabetic order, sorted by last name. Do not change the given case of the names. Do not ch

Which is the best way to append single quotes for a String in java

For example, String x= "ABC"; Which is the best way to convert ABC to 'ABC' ?

convert string to hex in lua?

I am going to send a byte array through socket.But I used to work in c/c++ and be new to lua. Now i have a problem,here is my question. i want to send a bytear

Why does this selectizeInput minimum values function not work correctly for 2 digit numbers even though it works fine for single digit numbers?

This one has me puzzled. The below code extract uses selectizeInput() to allow the user to choose to/from periods for purposes of data analysis (latter not show

How to shuffle strings in arrays in golang?

So I created a program to help me decide which game to play. Before I start my problem let me show you my code: package main import ( "fmt" "strconv"

Using Python to find drive letter (Windows)

I'm trying to write a python script (I'm a newbie) that will search the root directory of each connected drive on Windows for a key file and then return the dri

Why are some characters ignored when calling LastIndexOf?

Please take a look at these codes : string str_to_find = "➖➖➖➖➖➖➖➖➖➖\r\n"; string str

[]byte(string) vs []byte(*string)

I'm curious as why Go doesn't provide a []byte(*string) method. From a performance perspective, wouldn't []byte(string) make a copy of the input argument and ad