I'm trying to check whether or not the second argument in my program is a substring of the first argument. The problem is that it only work if the substring starts with the same letter of the string.
EDIT: It must be done in C, not C++. Sorry
int main(int argc, char **argv){
if (argc != 3) {
printf ("Usage: check <string o...
Hey can someone help with the following?
I'm trying to scrape a site that has the following information.. I need to pull just the number after the </strong> tag..
[<li><strong>ISBN-13:</strong> 9780375853401</li>, <li><strong>Pub. Date: </strong> 05/11/2010</li>]
[<li><strong>UPC:</strong> 490355000372</li>, <li><strong>Catalog No:</st...
Short of SQL-dumping my entire database to text and searching that, is there a way to search for a specific substring in all tables of a MySQL database if you are not sure which table/record/field that substring actually occurs?
...
Is there an elegant, cross-platform, industry standard way of implementing substr() in C?
or is it a case of every developer reinventing the wheel?
EDIT: Added 'cross-platform'.
...
Is there anyway to remove a character from a given position?
Let's say my word is:
PANCAKES
And I want to remove the 2nd letter (in this case, 'A'), so i want PNCAKES as my return.
Translate doesnt work for this.
Replace doesnt work for this.
Regex is damn complicated...
Ideas?
...
Hi,
As per my project I need to devide a string into two parts.
below is the example:
String searchFilter = "(first=sam*)(last=joy*)";
Where searchFilter is a string.
I want to split above string to two parts
first=sam* and last=joy*
so that i can again split this variables into first,sam*,last and joy* as per my requirement.
I d...
I have a huge "binary" string, like: 1110 0010 1000 1111 0000 1100 1010 0111....
It's length is 0 modulo 4, and may reach 500,000.
I have also a corresponding array: {14, 2, 8, 15, 0, 12, 10, 7, ...}
(every number in the array corresponds to 4 bits in the string)
Given this string, this array, and a number N, I need to calculate the ...
This program takes string like that 192.168.1.125 and cut every number then converts it to integer, but it returns an error.
import java.lang.String;
import java.lang.Number;
import java.lang.Integer;
class Ip
{
public static void main ( String [] args )
{
int i ;
i = args[0].indexOf ( '.' );
do
{
...
I have a batch file that I want to improve. Instead of requiring a user to provide a folder path without a trailing slash, is there an easy way for me to just remove the last character from the path if there is a slash on the end?
:START
@echo What folder do you want to process? (Provide a path without a closing backslash)
set /p datapa...
This this code:
SELECT SUBSTRING(posted,1,4) as year FROM styles
reader = cmd1.ExecuteReader(CommandBehavior.CloseConnection);
reader.Read();
Response.Write(reader[0].ToString());
I only get the string "System.Byte[]" printed out. How come?
If I use the software Mysql Query Browser I get the actual string from my database.
I underst...
I am fairly new to regular expressions and the more and more I use them, the more I like them. I am working on a regular expression that must meet the following conditions:
Must start with an Alpha character
Out of the next three characters, at least one must be an Alpha character.
Anything after the first four characters is an automa...
I have gVim and portable python stored in a DropBox folder on several machines. The location of the DropBox folder is different on each computer. However, I'd like to be able to setup the .vimrc so that it automatically references the correct python folder no matter what computer it's on.
For example, I have gVim in C:\DropBox\gVimPor...
I've got some code that creates a list of AD groups that the user is a member of, with the intention of saying 'if user is a member of GroupX then allow admin access, if not allow basic access'.
I was using a StringCollection to store this list of Groups, and intended to use the Contains method to test for membership of my admin group, ...
Am trying to create a well-optimised bit of code to create number of X-digits in length (where X is read from a runtime properties file), based on a DB-generated sequence number (Y), which is then used a folder-name when saving a file.
I've come up with three ideas so far, the fastest of which is the last one, but I'd appreciate any adv...
Hi all,
i have a little question ,i have a NSString object
(\n "1 Infinite Loop",\n "Cupertino, CA 95014",\n USA\n)
and i want the substring present within 2nd double quote and first comma of 2nd double quote (Ex.Cupertino) from this string.(Note: My string is Dynamic)
Till now i have used stringByReplacingOccurrencesOfString: and abl...
Say you have a string: "The ABC cow jumped over XYZ the moon" and you want to use jQuery to get the substring between the "ABC" and "XYZ", how would you do this? The substring should be "cow jumped over". Many thanks!
...
I can't seem to figure out how to find substring matches with SOLR, I've figured out matches based on a prefix so I can get ham to match hamburger.
How would I get a search for 'burger' to match hamburger as well? I tried burger but this tossed an error '*' or '?' not allowed as first character in WildcardQuery.
How can I match substr...
This is perhaps too easy but I do not know from where to start.
I have stings like "'02HEX'aspoodsasas'CR''LF'"
Now I want to extract stings between char(02) and char(12);
Until now I did following
string s = string.Format("{0}{1}{2}", (char)02, "12345678", (char)12);
int chindx = s.IndexOf((char)02)+1;
s = s.Substring(chindx, 8)
M...
I have the folowing xml code:
<weather-code>14 3</weather-code>
<weather-code>12</weather-code>
<weather-code>7 3 78</weather-code>
Now i'd like to only grab the first number of each node to set a background image. So for each node i have the folowing xslt:
<xsl:attribute name="style">
background-image:url('../icon_<xsl:value-of se...
I have created a process similar to Shazam that creates a Spectrogram of a given sound clip. I am trying to figure out a way in which to store this data into a database so that I can run comparisons on it. (I dont need actual code, just conceptual help on the process).
For those unfamiliar with a spectrogram, its a graph of time on the ...