startswith

Why does "abcd".StartsWith("") return true?

Title is the entire question. Can someone give me a reason why this happens? ...

Why is this Lucene query a "contains" instead of a "startsWith"?

string q = "m"; Query query = new QueryParser("company", new StandardAnalyzer()).Parse(q+"*"); will result in query being a prefixQuery :company:a* Still I will get results like "Fleet Africa" where it is rather obvious that the A is not at the start and thus gives me undesired results. Query query = new TermQuery(new Term("company",...

javascript startswith

how would i write the equivalent of c# startswith in javascript? var data = 'hello world'; var input = 'he'; //data.startsWith(input) == true ...

Java Number comparisons

Is there something I can use to see if a number starts with the same digit as another? Ex. 5643 and 5377 both start with five. Is there a way to do this with numbers or do they have to be strings? (startsWith?) ...

Why is function isprefix faster than Startswith in C#?

Hi, Does anyone know why C# (.NET)'s StartsWith function is considerably slower than IsPrefix? ...

Linq To NHibernate: .StartsWith on multiple properties

Hi, I'm trying to accomplish the following query (notice .StartsWith): return (from p in _session.Linq<Profile>() where (p.Firstname + " " + p.Lastname).StartsWith(wildcard) select p).ToList(); This throws: could not resolve property: Firstname.Lastname. If I do this: return (from p in _session.Linq<Profile>() ...

How do I check if a C++ <string> starts with a certain string, and convert a substring to an int?

How do I do the following (Python pseudocode) in C++? if argv[1].startswith('--foo='): foo_value = int(argv[1][len('--foo='):]) (For example, if argv[1] is '--foo=98', then foo_value is 98.) Update: I'm hesitant to look into Boost, since I'm just looking at making a very small change to a simple little command-line tool. (I'd ra...

Python: startswith any alpha character

How can I use the startswith function to match any alpha character [a-zA-Z]. For example I would like to do this: if line.startswith(ALPHA): Do Something ...

Prototype startsWith OR

Hi Guys, I am trying to use Prototype and startsWith but I want to check a number of values and little confused how to do this. Basically have this code: if(Category.startsWith("[Test1] " || "Test " || "Test2 ")) { some stuff } It doesn't appear to be working and just wondering what I am doing wrong ? ...

Starts with doesn't work in Linq to NHibernate query

In my repository I have: public IQueryable<ICustomer> GetByAddress(string address) { return from c in GetSession().Linq<ICustomer>() where c.Address.StartsWith(address) select c; } The SQL I'd like it to generate is essentially: SELECT * FROM Customer WHERE address LIKE @address + '%' However, whenever I d...

LINQ .Startswith or .Contains problems in VB.NET4

Hi! This may be a newbie question... In my code I can easily use "where Obj.Feld = String", but using "where Obj.Feld.StartsWith("a")" doesn't work. See the following two functions: Public Function EntriesByFileName(ByRef Database() As Entry, ByVal Filename As _ String) As IEnumerable(Of Entry) Dim Result As IEnumerable...

Xquery node values where node starts with same text

How to create xquery to select node values where node name starts with some text. for example document <doc> <cpv1>Value1</cpv1> <cpv2>Value2</cpv2> <cpv3>Value3</cpv3> <zzz>Hello world!</zzz> </doc> It should get Value1,Value2,Value3 ...

Why do Strings start with a "" in Java?

Possible Duplicate: Why does abcd.StartsWith() return true? Whilst debugging through some code I found a particular piece of my validation was using the .startsWith() method on the String class to check if a String started with a blank character Considering the following : public static void main(String args[]) { Strin...

startsWith() returning unexpected values

The class project has us reading in the title, artist and lyrics of 10,514 songs contained in a single text file. The current section of the project had us write an ordered unrolled linked list and run a search on the title field. The comparator was also written to sort the list by title. We have to keep track of the comparisons requi...