Check if the substring is in the chain

Let's say I have a list test = ["a","bb","ph","phi","phi_ph"] where a member of test can either contain the string ph, the string phi, a combination of these two, or none of them. How can I filter this lis

Python Pandas partial match of the chain

I created a dataframe df where I have a column with the following values: category 20150115_Holiday_HK_Misc 20150115_Holiday_SG_Misc 20140116_DE_ProductFocus 20140116_UK_ProductFocus I want to create 3 new columns category | A | B | C 20150115_Holida

In Javascript is a literal string an object?

This question already has an answer here: What is the difference between string literals and String objects in JavaScript? 7 answers I'm reading about the difference between String literal and String objects. See What is the difference between string

JQuery - Fractional chain (for each)

Current Code Below - I have to copy and paste each arr[0], arr[1], arr[2]. However, in the future I may have more or less array options and would like the code to auto update itself without needing to alter my code. Basically, I want to create a "for

Replace commas in the C # string

I have a string like this: select name,lastname,email from contacts I want to replace the commas for +"|"+ and get something like this select name+"|"+lastname+"|"+email from contacts thats easy with string.Replace(",&qu

PHP - Adds a null character to a string

I'm trying to append a number of NULL characters '\0' to a string in PHP. $s = 'hello'; while(strlen($s) < 32) $s .= '\0'; However, PHP adds 2 characters (\ and 0), instead of escaping the character and adding NULL. Does anyone know to add a NULL cha

MySQL - How can I do this channel search?

I have a table which features 37 columns, of various types, INTs and VARCHARS and 2 LONGTEXT columns. The client wants a search to search the table and find the rows that match. However, I'm having trouble with this. Here is what I've done so far: 1)

Convert a unicode list to a string list in python

I have this Unicode list list = [u'Hello\n', u'23456\n', u'45678\n',u'85963\n']. I want it to convert into the string list as below list1 = ['Hello','23456','45678','85963'] With minimal code.You can use str() and strip() in a list comprehension : >>

Returns the numeric value of a string in PHP

How can I get the numeric value from an string? In my case string is R1350.00 and Expected output: 1350 I tried the following: $result = preg_replace("/[^a-zA-Z0-9]+/", "", 'R1350.00'); but I also want to remove the last two string 00.

Chain Match Operation

I have two Strings (they can be anything) like I am a boy and I am a man. Where I am a is common. My task is to find out the common words from two strings. I used Set<String> to store the data, but it only stores unique values. So my question is, ho

Counting occurrences of a string in a string

My question is the following: Is there a string function that returns a count of occurrences, like substr_count(), but with a limiting option? I want to count the occurrences of 'a' in a string, but before the first newline.You can use substr() with

It is impossible to transmit data between these two fragments

I'm going insane!! I don't manage to pass data from a fragment(A) to an another fragment(B). I read about using a public interface... and it seems to work, but i don't understand how to use this method. Fragment(A) package it.anddev.pagertabs; public

Cut the numbers at the end of String

I want to trim the last occurring numeric characters from the String Eg: "abc123" => "abc" "abc12xyz34" => "abc12xyz" Written below snippet to extract it. Just want to explore if this can be done by regex priv

Retrieve the content of a web page

This question already has an answer here: How do you Programmatically Download a Webpage in Java 10 answers How to use to fire and handle HTTP requests 12 answers I'd like to fetch a webpage and save the content as a string? Is

Returns 2 strings with function in C #

This question already has an answer here: Return multiple values from a class to method 1 answer I have a function where I want to return 2 values? Is this possible? This is my code but it doesn't seem to like that I want to return 2 values public st

separate a variable with a symbol into different parts

using batch, i want to be able to separate a variable into two or three parts, when there is a symbol dividing them. for example if i have the string which looks like this: var1;var2; how can i get var1 to become variable and var2 to become a differe

Get the value of the option chosen in Spinner

I want to get value of choosed option in Spinner. I know, I can get this from setOnItemSelectedListener, but I don't want to use this. I have this: String spinner1odp = spinnerSubject.getSelectedItem().toString(); But result of this code is: android.

Long string used in Java

Let say I have to used a two paragraph string in my java program. What would be the best approach on this? Should the paragraph saved in a file and retrieved when used? Or there are better approach?It depends. If the paragraphs will never change, the

Can PHP foreach have if / else inside?

I am doing an OpenCart modification to an order total. This is the snippet of the code: <?php foreach ($data['totals'] as $total) { if ( $this->db->escape($total['code'])=="sub_total" || $this->db->escape($total['title'])="Su

Enter a special string while executing in C

In my C code I am given the following string as input: "c:\tc\bin\a c j k.jpg" I tried to read the input with scanf but it failed (passing the input both with and without quotation marks) and I am looking for an other solution. My code is as fol

How to use cURL to find subdomains containing specific strings?

I am trying to build a list of all the city pages on, which does not have such a complete directory. To do this I am using their 'city id' which is unique for each city, but does not follow any particular order. I am using cURL and PHP to lo

how to extract a chord part and ignore the number in jquery?

I have a string like foobar1, foobaz2, barbar23, nobar100 I want only foobar, foobaz, barbar, nobar and ignoring the number part.If you want to strip out things that are digits, a regex can do that for you: var s = "foobar1"; s = s.replace(/\d/g

Make a string with a string and an integer in Python

I get this error when trying to take an integer and prepend "b" to it, converting it into a string: File "", line 19, in getname name = "b" + num TypeError: Can't convert 'int' object to str implicitly That's relate

How to turn a dictionary into a string?

params = {'fruit':'orange', 'color':'red', 'size':'5'} How can I turn that into a string: fruit=orange&color=red&size=5 You can do it like this: '&'.join('%s=%s' % (k,v) for k,v in params.items()) If you are building strings for a URL it would

How to find and replace special characters utf-8 in Python?

I'm a Python beginner, and I have a utf-8 problem. I have a utf-8 string and I would like to replace all german umlauts with ASCII replacements (in German, u-umlaut 'ΓΌ' may be rewritten as 'ue'). u-umlaut has unicode code point 252, so I tried this:

How to join strings in PHP?

I have three strings: $str1 = "abc"; $str2 = "def"; $str3 = "ghi"; I can get the value of all of them like this: echo "$str1$str2$str3"; But I heard there is a way to join them together, so I can echo all of them wi