substring

On Disk Substring index

I have a file (fasta file to be specific) that I would like to index, so that I can quickly locate any substring within the file and then find the location within the original fasta file. This would be easy to do in many cases, using a Trie or substring array, unfortunately the strings I need to index are 800+ MBs which means that doing...

Can't figure out what this SubString.PadLeft is doing.

In this code I am debugging, I have this code snipit: ddlExpYear.SelectedItem.Value.Substring(2).PadLeft(2, '0'); What does this return? I really can't run this too much as it is part of a live credit card application. The DropDownList as you could imagine from the name contains the 4-digit year. UPDATE: Thanks everyone. I don't do a...

Finding numerical substrings mathematically, without string comparison.

This originally was a problem I ran into at work, but is now something I'm just trying to solve for my own curiosity. I want to find out if int 'a' contains the int 'b' in the most efficient way possible. I wrote some code, but it seems no matter what I write, parsing it into a string and then using indexOf is twice as fast as doing it...

Symbian C++ - Substring operations on descriptors

Hi What is the preferred/easiest way to manipulate TDesC strings, for example to obtain a substring. I will give you an example of my scenario. RBuf16 buf; ... CEikLabel label; ... label->SetTextL(buf); // (SetTextL takes a const TDesC&) I want to get a substring from buf. So do I want to manipulate the RBuf16 directly and if so wha...

How can I find a substring within a string using Perl?

I have a string from which I wish to extract a single word, but with a numerical appended to it, which might be different in each line: This is string1 this is string This is string11 This is string6 and it is in this line I want to parse this file and get the the values of "stringXXX", starting from 0 to 100 # suppose ABC.txt conta...

How can I parse people's full names into user names in Perl?

I need to convert a name in the format Parisi, Kenneth into the format kparisi. Does anyone know how to do this in Perl? Here is some sample data that is abnormal: Zelleb, Charles F.,,IV Eilt, John,, IV Wods, Charles R.,,III Welkt, Craig P.,,Jr. These specific names should end up as czelleb, jeilt, cwoods, cwelkt... etc ADDITION+++++ ...

Need help in getting PostgreSQL substring search with full text search working in my Django project

I am using the Python, Django framework and PostgreSQL combination. I am using the full text search of PostgreSQL (8.3) and am overriding the default filter function of Manager class in Django. Using the link: http://barryp.org/blog/entries/postgresql-full-text-search-django/ I was able to configure my full text search, as mentioned in t...

PHP Multiple Occurences Of Words Within A String

I need to check a string to see if any word in it has multiple occurences. So basically I will accept: "google makes love" but I don't accept: "google makes google love" or "google makes love love google" etc. Any ideas? Really don't know any way to approach this, any help would be greatly appreciated. ...

Select all but the first character in a string

How can you return a string minus the first character in a string in MySQL? In other words, get 'ello' from 'hello'. The only way I can think to do it is to use mid() with the second offset being larger than the string could possibly be: select mid('hello', 2, 99) But I'm convinced there must be a more elegant way of doing it. Is th...

C# Using Substring, how do I extract this string?

Hi, I want to extract the first folder in the URL below, in this example it is called 'extractThisFolderName' but the folder could have any name and be any length. With this in mind how can I use substring to extract the first folder name? The string: www.somewebsite.com/extractThisFolderName/leave/this/behind String folderName = path....

C# Substring and ToUpper

Hi all, I'm using substring and IndexOf to locate a value within a string but my code doesn't work if the string (strOldValue) below contains any of the string in a different case. So if strOldValue contained Test or TEST then my substring fails. How would I add ToUpper in this scenario? Forgive my ignorance I'm new to .Net. String str...

How to split string into substrings on iPhone?

I received an nsstring from the server. Now I want to split it into the substring I need. How to split the string? For example: substring1:read from the second character to 5th character substring2:read 10 characters from the 6th character. ...

Any sample code for componentsSeparatedByCharactersInSet? (on iPhone)

I want to split a long string received from a server to a few substrings. The separate characters are different. Are there any sample code for method: componentsSeparatedByCharactersInSet? Or may I ask a simple code to split "A~B^C" to "A", "B" and "C"? ...

How to pull out strings from array on iPhone?

I want to pull out a string from an array by index. e.g array with object: @"Hello", @"World" How to get @"World" from it? I use array[1], but it seems not work. ...

How to see if a substring exists inside another string in Java 1.4

How can I tell if the substring "template" exists inside a String in java 1.4 It would be great if it was a non case sensitive check. Thanks! ...

SQL Server substring breaking on words, not characters

I'd like to show no more than n characters of a text field in search results to give the user an idea of the content. However, I can't find a way to easily break on words, so I wind up with a partial word at the break. When I want to show: "This student has not submitted his last few assignments", the system might show: "This student ha...

C# - Search Binary File for a Pattern

What is the best way to search a large binary file for a certain substring in C#? To provide some specifics, I'm trying to extract the DWARF information from an executable, so I only care about certain parts of the binary file (namely the sections starting with the strings .debug_info, .debug_abbrev, etc.) I don't see anything obvious ...

LINQ: Group by month and year within a datetime field

I have a table with a datetime field. I want to retrieve a result set grouped by the month/year combination and the number of records that appear within that month/year. How can this be done in LINQ? The closest I've been able to figure out is in TSQL: select substring(mo,charindex(mo,'/'),50) from ( select mo=convert(varchar(2),mont...

finding substrings in python

hi, Can you please help me to get the substrings between two characters at each occurrence For example to get all the substrings between "Q" and "E" in the given example sequence in all occurrences: ex: QUWESEADFQDFSAEDFS and to find the substring with minimum length. ...

What's the most efficient way to find one of several substrings in Python?

Hello, I have a list of possible substrings, e.g. ['cat', 'fish', 'dog']. In practice the list contains hundreds of entries. I'm processing a string, and what I'm looking for is to find the index of first appearance of any of these substrings. To clarify, for '012cat' the result is 3, and for '0123dog789cat' the result is 4. I also...