Re: Get index of string in array at compile time

2015-05-29 Thread Timon Gehr via Digitalmars-d-learn
On 05/29/2015 06:43 PM, tcak wrote: I have define an immutable string array: [code] immutable string[] placeHolderDefinitionList = [ "", "" ]; [/code] I need to get index of a string at compile time. So I have written a function as below: [code] public size_t getPlaceholderIndex(stri

Get index of string in array at compile time

2015-05-29 Thread tcak via Digitalmars-d-learn
I have define an immutable string array: [code] immutable string[] placeHolderDefinitionList = [ "", "" ]; [/code] I need to get index of a string at compile time. So I have written a function as below: [code] public size_t getPlaceholderIndex(string PlaceHolderText)( size_t