
String Theory, a string library for OpenSCAD
Description
This Library Is A Spin Off Of [Relativity](Http://Www.Thingiverse.Com/Thing:349943), My Other Openscad Library. I Needed A String Processing Library For Some More Advanced Features I Wanted To Implement, And Since None Were Available To My Liking I Rolled My Own With Help From Some [Earlier Work](Http://Www.Thingiverse.Com/Thing:202724) By [Roipoussiere](Http://Www.Thingiverse.Com/Roipoussiere). The Library Includes The Following Functions: * Before(String, End) * After(String, Start) * Between(String, Start, End) * Substring(String, Start, Length) * Upper(String) * Lower(String) * Is_Empty(String) * Is_Null_Or_Empty(String) * Is_Null_Or_Whitespace(String) * Equals(This, That, Ignore_Case=False) * Starts_With(String, Start, Ignore_Case=False) * Ends_With(String, End, Ignore_Case=False) * Reverse(String) * Trim(String) * Parse_Int(String, Base) * Tokenize(String, Index) * Join(Strings, Delimiter) * Split(String, Seperator=" ", Ignore_Case = False) * Index_Of(String, Goal, Ignore_Case=False, Regex=False) * Contains(String, Substring, Ignore_Case=False, Regex=False) * Replace(String, Replaced, Replacement, Ignore_Case=False, Regex=False) * Grep(String, Pattern) * Peg(String, Grammar) All Functions Are Compatible With The Latest Production Release Of Openscad, 2015.03. No Dev Release Needed. For Those Still Using Version 2014.03, You Can Still Use The Older Version Of The Library By Checking The Project History On Github. Code Shares Its Repository With Relativity.Scad: Https://Github.Com/Davidson16807/Relativity.Scad/Blob/Master/Strings.Scad **2/2/2015** That Right Woodchuck Chuckers, It'S Groundhog'S Day. A New Function Has Been Added, Called `Peg()`. This Function Offers Support For [Parsing Expression Grammars](Https://Github.Com/Philippesigaud/Pegged/Wiki/Peg-Basics). Parsing Expression Grammars Allow You To Create Your Own Mini Programming Languages Within Openscad. The Engine Is Currently Too Slow To Describe Complex Languages Using Backus-Naur Form, But For Now You Can Specify Grammars Using An Intermediate Format That Uses Nested Lists. Look To `_Rx_Peg` In The String.Scad Source Code For An Example Grammar - This Is The Grammar Used Within Strings.Scad To Describe Regular Expressions. You Can Also Find Some Nacent Documentation Available [Here](Https://Github.Com/Davidson16807/Relativity.Scad/Wiki/String-Theory) **3/17/2015** Happy Patty'S Day. Thanks To New Functionality In 2015.03, All String Processing Functions Return A List Of Strings, Where Appropriate; E.G. Grep() Now Returns A List Of Strings Matching The Input Regex. **11/27/2014** Thanksgiving Update. Regex Now Supports Negative Character Sets ("[^Aeiou]"), Character Ranges ("[A-Z]"), And Curly Bracket Repetition (".{2,3}"). **11/13/2014** Added Regular Expression Engine. The Engine Supports All Basic Regex Operators ("|", "*", "+", "?", "."), Anchors ("^", "$"), Character Sets ( "[...]"), Metacharacters ("D","S", "W"), Parentheses, And Operator Precedence. Regex Functionality Is Exposed Where Ever There Is A "Regex" Parameter Flag In A Method'S Signature, And Of Course, Through Grep().
Statistics
Likes
48
Downloads
0