12 Topics
| |
how do I do pattern matching for something like `/^(.*)text/` and `/text(.*)$/`? | |
Hello everyone. I am building a small database that will hold information about volunteers and their talents. I have created a search form, in which the user can enter a keyword and it will search the tables for any match. Currently I am using a criteria of: Like "*" & … | |
List<? extends Integer> list = new ArrayList<Integer>(); for (Integer element : list) { System.out.println(element); List<? super Integer> list = new ArrayList<Integer>(); for (Integer element : list) { System.out.println(element); For the first three lines as Case 1 using extends it compiles fine. But for Case 2 of next three lines, it … | |
<? super Animal> means animal or it's superclass only. Then why inside the method it's allowing to add Dog object even though it's a subclass of Animal? This program compiles and runs! import java.util.*; class Cat {} class Animal{Animal() {System.out.println("Animal constructor");}} class Dog extends Animal{Dog() {System.out.println("Dog constructor");}} public class GenericDemo5 … | |
import java.util.*; class SampleA { } class SampleB extends SampleA{ } class SampleC extends SampleA{ } class VectorDemo { public static void main(String r[]) { Vector<SampleA> v = new Vector<SampleA>(); v.add(new SampleB()); v.add(new SampleC()); SampleC rect = v.get(2); } } The output says "Incompatible types. Found SampleA, required SampleC. SampleC … | |
Here slightly edited code from one of my earliest posts to DaniWeb. Limitted by recursion limit of Python as it uses recursion, but interesting for me. | |
Hello I'm not sure how this is possible but I want to enter a wildcard(?) into a php variable.. like this, <?php if($_SERVER['HTTP_HOST'] == '*.domain.com') { //do something } ?> Notice the * I basically need it to match if its any subdomain of domain.com Possible? | |
I am new to this forum. I need help in defining the same kind of function according to my requirements. as [url]http://www.codeproject.com/Articles/1088/Wildcard-string-compare-globbing[/url] I hope, I 'll get good response. Words are strings which are separated by dots. Two additional characters are also valid i.e:The *, which matches 1 word and … | |
Hi I have a macro in excel that, creates an email in outlook. The issue I have is, this spreadsheet can be used by multiple people and I want their corresponding email signature in the email when they send it The signature code I have is : SigString = "C:\Documents … | |
The sort methods for collections specifies that the parameter must be a collection of objects that implement Comparable for their own class or superclass, eg [CODE]public static <T extends Comparable<? super T>> void sort(List<T> list)[/CODE] Can anyone tell me how to define an ArrayList that will only accept such objects? … | |
Consider the following code : [CODE]class R2<E> { E a; E get() { return a; } void set(E a) { this.a=a; } } class R3 { void doit(R2 a) // (1) { a.set(new Integer(5)); } }[/CODE] When I compile the file containing class R3, it rightly gives an unchecked warning … | |
Hi people, I'm trying to match strings from a pattern containing[B] wildcards[/B]. Basically I need to be able to go through a stack of strings, and see which of them matches my pattern. Fx [B]My*.txt[/B] will match only one of these. [U]MyFile.txt[/U] [I]MyFile.php[/I] I'm aiming to end up with a … |
The End.