wildcard

Angular 7 router '**' wildcard with lazy load module and child routes not working?

社会主义新天地 提交于 2019-12-08 05:08:17
问题 I'm trying to create a default route using the wildcard '**' from Angular's router. That default route will load a lazy module and then it will have to solve its own routes. The problem is that when I have the following configuration it does not resolve as expected: export const routes = [ { path: '', component: 'DashboardComponent' }, { path: '**', loadChildren: './lazy/lazy.module#LazyModule' } ]; @NgModule({ imports: [ BrowserModule, RouterModule.forRoot(routes) ], declarations:

C# LINQ: how to handle wildcard search?

让人想犯罪 __ 提交于 2019-12-08 05:02:32
问题 I need a search function like this: The function accepts all strings with many types of wildcards: * or % >>> can replace one or more characters # >>> used to replace a number @ >>> used to replace an alphabet ? >>> used to replace a character (can be both number and alphabet) As I know, in LINQ there are 3 functions for searching strings: StartsWith, EndsWith and Contains. In SQL query, there are 2 types of LIKE: % for one or more characters and _ for only one character. So, how can I solve

mysql detail query string, like wildcard

拜拜、爱过 提交于 2019-12-08 02:13:05
问题 Not sure how to title my question... lol. Below is what i am needing. Values in my database look like the following: test_example-1, test_example-2, test_example-TD-1 The values can vary in length, "test_example-" is just an example, some of the values will have varying names. When i perform a query to grab all the values that look like this "test_example-" i get everything, because i am using the wild card value this way "test_example-%". However, i do not want the "test_example-TD-1" in the

Java string matching with wildcards

Deadly 提交于 2019-12-08 00:41:00
问题 I have a pattern string with a wild card say X (E.g.: abc*). Also I have a set of strings which I have to match against the given pattern. E.g.: abf - false abc_fgh - true abcgafa - true fgabcafa - false I tried using regex for the same, it didn't work. Here is my code String pattern = "abc*"; String str = "abcdef"; Pattern regex = Pattern.compile(pattern); return regex.matcher(str).matches(); This returns false Is there any other way to make this work? Thanks 回答1: Just use bash style pattern

Generics and wildcards in Java [duplicate]

谁说我不能喝 提交于 2019-12-07 23:26:01
问题 This question already has answers here : Is List<Dog> a subclass of List<Animal>? Why are Java generics not implicitly polymorphic? (17 answers) Closed 12 months ago . I have recently taken on a Java course about generics and wildcards. I am not able to grasp the difference between them and, sometimes, even the need to use them. Two questions, please: 1) An order has a list of products, and we have sheets and clips as products. public class Product {} public class Sheet extends Product{}

Java Generic Type for Wildcard extends allow to add only null

≯℡__Kan透↙ 提交于 2019-12-07 20:38:40
问题 I am using the below code and tryin to add CHild object is the list: List<? extends Parent> list = new ArrayList<Child>(); list.add(new Child()); //error: The method add(capture#1-of ? extends Parent) in the type List<capture#1-of ? extends Parent> is not applicable for the arguments (Child) class Parent{ } class Child extends Parent{ } I want to know why compiler throws error here? 回答1: If you go through the Generic Guidelines stated by Oracle docs, these kind of list declarations are tend

SQL Update Replace statement

浪尽此生 提交于 2019-12-07 16:29:25
问题 I need to write a sql update statement using REPLACE. The string looks like 'SE*88*000000001'. I need to replace the number between the two asterisks '*'. There is no pattern here other then that number to be replaced is always between two asterisks. Is it possible to use wild cards in this situation? Appreciate your help. Thanks! 回答1: ; WITH RowSetToUpdate AS ( SELECT acolumn, Asterisk1Pos = CHARINDEX('*', acolumn), Asterisk2Pos = CHARINDEX('*', acolumn, CHARINDEX('*', acolumn) + 1) FROM

Returning Collection<? extends Type> vs Collection<Type>

本秂侑毒 提交于 2019-12-07 11:13:37
问题 What is the difference between these two methods? Collection<Type> getTypes(); vs Collection<? extends Type> getTypes(); Does it matter if Type is a class or an interface? Especially, when designing an API, which version would be preferred and why? 回答1: Collection<Type> getTypes(); Here, getTypes() must return a Collection<Type> (e.g. ArrayList<Type> or HashSet<Type> ). Collection<? extends Type> getTypes(); Here, getTypes() can return a Collection of anything that is or extends Type , (e.g.

Java HashMap with ArrayList wildcards

爱⌒轻易说出口 提交于 2019-12-07 10:58:35
问题 I have a HashMap where the values are ArrayLists, and I'm trying to write a function to accept generic instances of these HashMaps HashMap<String, ArrayList<Integer>> myMap = new HashMap<String, ArrayList<Integer>>(); public static void foo(HashMap<?, ArrayList<?>> a) {} public static void bar(HashMap<?, ? extends ArrayList<?>> a) {} // Compilation Failure! foo(myMap); // This works, but why do I need ? extends ArrayList bar(myMap) The error message is The method foo(HashMap<?,ArrayList<?>>)

Wildcard in dictionary key

微笑、不失礼 提交于 2019-12-07 10:54:17
问题 Suppose I have a dictionary: rank_dict = {'V*': 1, 'A*': 2, 'V': 3,'A': 4} As you can see, I have added a * to the end of one V. Whereas a 3 may be the value for just V, I want another key for V1, V2, V2234432, etc...I want to check it against: checker = 'V30' and get the value. what is the correct syntax for this? for k, v in rank_dict.items(): if checker == k: print(v) 回答1: You can use fnmatch.fnmatch to match Unix shell-style wildcards: >>> import fnmatch >>> fnmatch.fnmatch('V34', 'V*')