substring

More optimized solution, find number of substrings in a string. Using C.

Hi All, So, I have a task to find number of substrings in given string. I can't use any C libraries for doing this task. stringExist can only have 2 strings as a parameters. My solution is working, but I have a feeling that there should be a more elegant way to do this task. Solution 1: as it turns out, it doesn't work correctly #incl...

Using substring-after to search text in XPath query

I trying to parse a string in an XML node by using an XPath query which requires that I strip out a substring and read the remaining value. The substring may have a dynamic amount of whitespace before and after it before I can get to the value, so it would be helpful to have some sort of a indexOf function to use in the XPath. I'm tryi...

How to find nth occurrence of character in a string?

Similar to a question posted here, am looking for a solution in Java. That is, how to find the index of nth occurrence of a character/string from a string? Example: "/folder1/folder2/folder3/". In this case, if I ask for 3rd occurrence of slash (/), it appears before folder3, and I expect to return this index position. My actual inte...

Slight problem getting mySQL SUBSTRING to work..

I know I am pretty close with this, as I have recieved some help on this topic earlier, but when it cam to making the same code work for another part of the site it seems I cannot get it working again. What I am doing is trying to get the first part of a string (which is broken by a - delimiter in the database) so the db entry slug woul...

mySQL substring & instr problem

Anyone able to have at look at this? still un-resolved and am desperate to get this working, I am confident I know how the code is working, it is just a problem with the WHERE clause. I need it so that the var $pageGrandChild matches the last part of a string in the database i.e. foo-bar-rules. Any ideas? $pageGrandChild = PAGEGRANDCHI...

How do you first find a class that contains a string and then get the id of the element with that class you just found? Using Javascript.

What I'm trying to do is search a page for an element that has the string 'tab_selected' in the class name. The class name is more than just 'tab_selected'. Its 'tab_selected + the UUID'. The UUID changes so all I really want to search for is if the class name contains 'tab_selected' and then if it does I want to get the ID of that eleme...

Multiple string and condition matching?

I have a program which needs to be able to search through an ArrayList of 'book' objects, and decide which ones meet given criteria. You can search by Name, ID Number, or Year published. Or just by any assortment of the above. Currently i use nested if statements, where a null value means that field wasn't specified and to display all...

exclude the first letter of a sentence from get_the_content() wordpress function

hello! Anybody know how can I exclude only the first letter of a get_the_content() function in wordpress? could be a snippet like that, but it doesn't work! substr(strip_tags(get_the_content()), 1, get_the_content().length) thanks a lot in advance :) ...

Designing a simple state machine generator

I know that designing state machine generators for regular expressions is not trivial, but what about simple strings (when I say a simple string, I mean something like "abcd" -- something without any regular expression syntax). I was thinking of writing a simple string matcher using state machines, but I wanted the state machine to be ge...