Data dodania Pytanie
2018-02-15 08:02 convert substrings to dict »
Looking for a elegant way to convert a list of substrings and the text between them to key, value pairs in a dict. Example: s = 'k1:some text k2:mor...
(6) odpowiedzi
2018-02-10 15:02 turn string separated by spaces to arraylist of integers in one line »
Say I have the String "5 12 4". I'd like to turn that into an ArrayList of Integers containing 5,12 and 4 in a single functional line. I feel there ...
(2) odpowiedzi
2018-02-09 02:02 Difference between Kotlin and Java String split with Regex »
If we have a val txt: kotlin.String = "1;2;3;" and like to split it into an array of numbers, we can try the following: val numbers = string.split(";...
(1) odpowiedzi
2018-02-08 11:02 Python: str.startswith() and string comparison "==" not working »
I'm trying to read a string from a file and find words that start with "'param." This is my code: # -*- coding: utf-8 -*- inputfile = open('abc.json...
(1) odpowiedzi
2018-02-08 09:02 Find a distance measure of graphical similarity of two strings »
I had no luck at finding any package like that, optimally in Python. Is there some library allowing one to graphically compare two strings? It would,...
(2) odpowiedzi
2018-02-08 02:02 How is '2'+'2'-'2'= 20 in JavaScript? »
I was just randomly playing around JavaScript. The '2'+'2'-'2' input I given to it. and the output is surprisingly 20. console.log('2'+'2'-'2')...
(3) odpowiedzi
2018-02-04 09:02 Most pythonic way to print strings? »
Let's say I have an array and I want to print out its length along with a string. In Java, I would do this: System.out.println("The length of the lis...
(0) odpowiedzi
2018-02-03 22:02 Splitting a List Based on a Substring »
I have the following list: ['1(Reg)', '100', '103', '102', '100', '2(Reg)', '98', '101', '100', '3(Reg)', '96', '99', '98', '4(Reg)', '100', '100', '...
(8) odpowiedzi
2018-02-03 19:02 String without quotes within a string (python) »
I'm trying to write text to file, but I have other text I need to include besides the targeted string. When I'm looping over the targeted strings it i...
(2) odpowiedzi
2018-02-03 00:02 Java 8/9: Can a character in a String be mapped to its indices (using streams)? »
Given a String s and a char c, I'm curious if there exists some method of producing a List<Integer> list from s (where the elements within list ...
(4) odpowiedzi
2018-02-01 15:02 How do I split a Very huge string And string without spaces?(python3) »
Firstly I have this long string s = '1MichaelAngelo' How can I get the output as new_s = '1 Michael Angelo' and as a list new_list = [1,'Mi...
(1) odpowiedzi
2018-01-31 07:01 Matching strings in a column of a data frame with the strings in a column of another data frame using R or Python »
I am trying to match strings in a column of a data frame with the strings in a column of another data frame and map the corresponding values. The numb...
(4) odpowiedzi
2018-01-30 07:01 Faster way to get substring in python? »
I am coding Skew Algorithm to construct the Suffix Array and I have a long string (length >= 4000). In Skew Algorithm, I have to construct the Triples...
(3) odpowiedzi
2018-01-24 12:01 Fastest way to generate a random-like unique string with random length in Python 3 »
I know how to create random string, like: ''.join(secrets.choice(string.ascii_uppercase + string.digits) for _ in range(N)) However, there should b...
(4) odpowiedzi
2018-01-19 10:01 Swift convert string to function name (#selector) »
I made a function which inputs a string. That string must be converted to a function name which should be passed to a #selector parameter. I tried thi...
(1) odpowiedzi
2018-01-17 06:01 Search multiple strings in string »
In a given string, it is easy to search for the first occurrence of a substring like this: int position = "01234".IndexOf ("23"); // returns 2 I wa...
(6) odpowiedzi
2018-01-17 00:01 C#: Switch-case statement with String or Int? »
Seems like a very "preference" based question but: Of these two code, which is more preferable: var someString="1"; switch (Convert.ToInt32(someStri...
(5) odpowiedzi
2018-01-15 23:01 cyrillic strings Я̆ Я̄ Я̈ return length 2 instead of 1 in ruby and other programming languages »
In Ruby, Javascript and Java (others I didn't try), have cyrillic chars Я̆ Я̄ Я̈ length 2. When I try to check length of string with these char...
(3) odpowiedzi
2018-01-15 01:01 Difference between C++ object construction methods »
The different construction syntaxes in C++ have always confused me a bit. In another question, it was suggested to try initializing a string like so ...
(2) odpowiedzi
2018-01-07 18:01 String Pool behaves differently when used with concat? »
String s1 = "Hello".concat("World"); String s3 = new String("HelloWorld"); //Line-2 String s2 = s1.intern(); System.out.println(s1 == s2); //false Sys...
(1) odpowiedzi
2018-01-07 06:01 Java: valueOf vs copyValueOf »
What is the difference between valueOf and copyValueOf. I looked on GrepCode, only to find that both return the exact same thing. copyValueOf: Pa...
(3) odpowiedzi
2018-01-06 20:01 index out of string, ruby »
Here's a small part of my code, pretty self explanatory, it copies all characters to temp from input and skips spaces. input = gets.to_s.chomp temp=S...
(3) odpowiedzi
2018-01-04 13:01 SQL Server Multiple Replacements »
Using SQL Server 2008 R2 - 2016. I have inherited a function we use to make friendly urls - i.e. multiple character replacements. I've just opened it ...
(1) odpowiedzi
2018-01-03 12:01 Difference between N'String' vs U'String' in oracle »
What is the meaning and difference between these queries? select u'a' from dual; AND select n'a' from dual; ...
(2) odpowiedzi
2018-01-02 09:01 Efficient string similarity grouping »
Setting: I have data on people, and their parent's names, and I want to find siblings (people with identical parent names). pdata<-data.frame(pa...
(4) odpowiedzi
2018-01-01 20:01 How to split "\t" in a string to two separate characters as "\" and "t"? (How to split Escape Sequence?) »
I am trying to split a string in python into a list of characters. I know that there are a lot of ways to do this in python, but I have a case where t...
(4) odpowiedzi
2018-01-01 14:01 Using String#split Method »
By default, the #split method work as follows: "id,name,title(first_name,last_name)".split(",") will give you following output: ["id", "name", "ti...
(3) odpowiedzi
2017-12-29 00:12 Replacing links around image tags with PHP »
I have a string (in Wordpress) with HTML content and I want to replace every link URL around an image tag with another URL: Before: <a href="A"&gt...
(2) odpowiedzi
2017-12-27 19:12 Safe string output in React ecosystem »
If you want to display a string like °F in a React view as °F, I've found the documented way to do this as something like: import React f...
(2) odpowiedzi
2017-12-27 17:12 How can I concatenate two fields from a list using Java 8 and StringJoiner? »
I have class: public class Item { private String first; private String second; public Item(String first, String second) { this.firs...
(3) odpowiedzi
2017-12-27 16:12 What is the proper way to add a method to a built-in class in ruby? »
In exercism.io I have submitted a solution ot the Pangram Problem in Ruby. To solve the problem, I created a method for the String class called alpha?...
(3) odpowiedzi
2017-12-27 16:12 Sort array on the basis of the last word of string »
I have an array like: ["https://yallamotor-development-assets.s3.ap-south-1.amazonaws.com/2650497/img_0_0_0.jpg", "https://yallamotor-development-as...
(5) odpowiedzi
2017-12-24 16:12 Rspec failure - make user name case sensitive »
first question for me here. I am a new Ruby/Rails developer and I set up some rails tests for creating a user ie name, email, password, and a passwor...
(0) odpowiedzi
2017-12-22 11:12 Java String.replace() or StringBuilder.replace() »
In scenarios where I am using 5-10 replacements is it necessary to use stringbuilder. String someData = "......"; someData = someData.replaceAll("(?s...
(1) odpowiedzi
2017-12-18 05:12 Iterating over a large string and checking membership of substrings in a dictionary performance »
I am currently implementing Huffman coding in python and I've finished it but I want to make it more efficient. This is the method I use to get the c...
(2) odpowiedzi