I’m starting to feel like a broken record when I say one of my favorite things to do is write functions that will leverage the SQL server substring to select from the starting position of your first character, string, or delimeter aka your input string. I’ve previously written a String Extract Extension Method with C# and of course I’ve also written a StringExtractComponent for CakePHP in case you’re interested in something similar in different programming languages.
(more…)
Tag: substring
-
SQL substring between two characters
-
String Extract Extension Method with C#
The following extension method is probably one of my all time favorite things to do with strings: parse out text between a start and end delimiter.
-
JavaScript – Search a string for a substring
You want to search a string variable to determine if it contains a matching substring value.
To search for a string inside of a string contains several different methods, each offering their own benefit. The most common solutions involve the indexOf function or using a regular expression with the match function.
-
StringExtractComponent for CakePHP
Hi folks, I have just finished creating my first CakePHP component and I wanted to share it with the community. After I finish writing this article, I will be submitting it to CakePHP for inclusion.
The component is called StringExtractComponent. As you may guess, it extracts content from a piece of content. I have created this component to mimic the STREXTRACT function in Microsoft Visual FoxPro. I have come to fall in love with this function because it makes retrieving data from a string with a start and end delimiter. I’ve also created two other examples with SQL substring between two characters SQL substring between two characters as well as a String Extract Extension Method with C#.
To help you understand how it is used, I read the contents of one of my articles into a string. I then proceed to extract a specific section that is contained within the code syntaxes that exist in the article and it is important to truncate a string.
(more…)