Category "string"

Hex String to Byte array conversion java

I know this question is asked a lot of times but please hear me out. Previously I have tried following methods to convert hex string to byte array. say my key

Most efficient string similarity metric function

I am looking for an efficient implementation of a string similarity metric function in Python (or a lib that provides Python bindings). I want to compare strin

Pascal 'Split' Function

I am coding a little program in pascal and I have run into a small problem. In other languages there is a function named 'split' or 'explode' to take a long str

How can I fill empty space with null in a pdf? using pdfbox

I am using Java PDFBOX to read a pdf It is a very long pdf with more than 40 pages, and I need to extract more than 100 elements on each page, doing it manually

Isn't a 2-byte char datatype insufficient to deal with the concept of "characters" in a Unicode string?

Various programming languages use a 2-byte char datatype (not to be confused with C/C++'s char, which is just one byte) out of which strings are constructed. Va

Initialize a String from a range of Characters in Swift

In our code, we found a bug from not writing the alphabet correctly. Instead of "0123456789abcdefghijklmnopqrstuvwxyz", we had "0123456789abcdefghijklmnoqprstuv

Javascript: find all occurrences of word in text document

I'm trying to write a Javascript function to find indices of all occurrences of a word in a text document. Currently this is what I have-- //function that find

How can I check the first character in a string in Bash or Unix shell?

I'm writing a script in Unix where I have to check whether the first character in a string is "/" and if it is, branch. For example, I have a string: /some/dire

string split with expand=True. Can anyone explain what is the meaning?

all_data['Title']= all_data['Name'].str.split(', ', expand=True)[1].str.split('.', expand=True)[0] Can anyone explain what is the meaning of this line of code?

Object of class stdClass could not be converted to string error

I have the following string: {"Coords":[{"Accuracy":"65","Latitude":"53.277720488429026","Longitude":"-9.012038778269686","Timestamp":"Fri Jul 05 2013 11:59:34

python if user input contains string

Very basic question. We have the code: a = input("how old are you") if a == string: do this if a == integer (a != string): do that Obviously it d

C++ - Split string by regex

I want to split std::string by regex. I have found some solutions on Stackoverflow, but most of them are splitting string by single space or using external lib

SQL Server convert select a column and convert it to a string

Is it possible to write a statement that selects a column from a table and converts the results to a string? Ideally I would want to have comma separated value

JavaScript equivalent of python string slicing

Is there a JavaScript equivalent to this Python method of string slicing? >>> 'stackoverflow'[1:] 'tackoverflow' I have tried: // this crashes console

First Not Repeating Character Code

Here is the question: Write a solution that only iterates over the string once and uses O(1) additional memory, since this is what you would be asked to do duri

Replace a name in a string in Python

I'm working on a assignment and I need to replace Alice with my name. Here is the program, for i in range(10): print(i) print(split_alice[i]).replace_a

How to convert binary string to normal string in php

Description of the problem I am trying to import email content into a database table. Sometimes, I get an SQL error while inserting a message. I found that it f

VS Code Extension API - Replace a String in the document?

const textEditor = vscode.window.activeTextEditor; if (!textEditor) { return; // No open text editor } for(var i=

How do I escape a series of backslashes in a bash printf?

The following script yielded an unexpected output: printf "escaped slash: \\ \n" printf "2 escaped slashes: \\\\ \n" printf "3 escaped slashes: \\\\\\ \n" prin

Why all the test cases are not getting passed for the below question?

The Coding Question which I am trying to solve is this. I tried to solve but not all the test cases passed I am not able to find what could be the reason? Iden