{"id":150,"date":"2011-10-12T11:15:56","date_gmt":"2011-10-12T16:15:56","guid":{"rendered":"http:\/\/thenoyes.com\/littlenoise\/?p=150"},"modified":"2011-10-12T11:15:56","modified_gmt":"2011-10-12T16:15:56","slug":"extract-range-characters","status":"publish","type":"post","link":"https:\/\/thenoyes.com\/littlenoise\/?p=150","title":{"rendered":"Extract range characters"},"content":{"rendered":"<p>Given a source string and a two-character range string, extracts all characters from the source that fall within the range. Sort of a simple version of the [A-Z] syntax from regular expressions. <\/p>\n<p>Examples:<br \/>\nextractRange(&#8216;123-ABC-456&#8217;, &#8216;AZ&#8217;) returns &#8216;ABC&#8217;<br \/>\nextractRange(&#8216;123-ABC-456&#8242;, &#8217;09&#8217;) returns &#8216;123456&#8217;<\/p>\n<pre>CREATE FUNCTION extractRange(inString TEXT, inRange char(2)) \r\nRETURNS TEXT \r\nDETERMINISTIC\r\nBEGIN\r\nDECLARE returnString TEXT DEFAULT '';\r\nDECLARE pointer INT DEFAULT 1;\r\nWHILE pointer <= CHAR_LENGTH(inString) DO\r\n    IF MID(inString, pointer, 1) BETWEEN LEFT(inRange, 1) AND RIGHT(inRange, 1) THEN\r\n        SET returnString := CONCAT(returnString, MID(inString, pointer, 1));\r\n    END IF;\r\n    SET pointer := pointer + 1;\r\nEND WHILE;\r\nreturn returnString;\r\nEND<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Given a source string and a two-character range string, extracts all characters from the source that fall within the range. Sort of a simple version of the [A-Z] syntax from regular expressions. Examples: extractRange(&#8216;123-ABC-456&#8217;, &#8216;AZ&#8217;) returns &#8216;ABC&#8217; extractRange(&#8216;123-ABC-456&#8242;, &#8217;09&#8217;) returns &#8216;123456&#8217; CREATE FUNCTION extractRange(inString TEXT, inRange char(2)) RETURNS TEXT DETERMINISTIC BEGIN DECLARE returnString TEXT DEFAULT [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[],"class_list":["post-150","post","type-post","status-publish","format-standard","hentry","category-mysql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2IBF1-2q","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=150"}],"version-history":[{"count":1,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":151,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/150\/revisions\/151"}],"wp:attachment":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}