digitalmars.D.learn - Multi-Prefix Version of skipOver()
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (11/11) Nov 15 2014 What's currently the fastest way of removing the largest matching
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (7/19) Nov 15 2014 So I hacked together skipOverShortestOf at
What's currently the fastest way of removing the largest matching prefix from an array of prefix arrays from an array in D like auto x = "first_second"; x.skipOverLargestMatch(["fir", "first"]); assert( == "_second"); auto x = "first_second"; x.skipOverLargestMatch(["fir"]); assert( == "st_second"); The list of prefixes is preferrably dynamically generated but can also a variadic list of arguments if necessary. I guess we could reuse variadic find in the static case.
Nov 15 2014
On Saturday, 15 November 2014 at 14:41:29 UTC, Nordlöw wrote:What's currently the fastest way of removing the largest matching prefix from an array of prefix arrays from an array in D like auto x = "first_second"; x.skipOverLargestMatch(["fir", "first"]); assert( == "_second"); auto x = "first_second"; x.skipOverLargestMatch(["fir"]); assert( == "st_second"); The list of prefixes is preferrably dynamically generated but can also a variadic list of arguments if necessary. I guess we could reuse variadic find in the static case.So I hacked together skipOverShortestOf at https://github.com/nordlow/justd/blob/master/skip_ex.d#L39 Now I need help figuring out how to implement skipOverLongestOf hopefully by reusing skipOverShortestOf. Other comments would also be great.
Nov 15 2014