Re: How to get a substring?

2013-10-26 Thread Timothee Cour
On Sat, Oct 26, 2013 at 6:24 PM, Nicolas Sicard wrote: > On Sunday, 27 October 2013 at 00:18:41 UTC, Timothee Cour wrote: > >> I've posted a while back a string=>string substring function that doesn't >> allocating: google >> "nonallocating unicode string manipulations" >> >> code: >> >> auto sli

Re: How to get a substring?

2013-10-26 Thread Jonathan M Davis
On Saturday, October 26, 2013 15:17:33 Ali Çehreli wrote: > On 10/26/2013 02:25 PM, Namespace wrote: > > On Saturday, 26 October 2013 at 21:23:13 UTC, Gautam Goel wrote: > >> Dumb Newbie Question: I've searched through the library reference, but > >> I haven't figured out how to extract a substring

Re: How to get a substring?

2013-10-26 Thread Nicolas Sicard
On Sunday, 27 October 2013 at 00:18:41 UTC, Timothee Cour wrote: I've posted a while back a string=>string substring function that doesn't allocating: google "nonallocating unicode string manipulations" code: auto slice(T)(T a,size_t u, size_t v)if(is(T==string)){//TODO:generalize to isSomeS

Re: How to get a substring?

2013-10-26 Thread Timothee Cour
I've posted a while back a string=>string substring function that doesn't allocating: google "nonallocating unicode string manipulations" code: auto slice(T)(T a,size_t u, size_t v)if(is(T==string)){//TODO:generalize to isSomeString import std.exception; auto m=a.length; size_t i; enforce(u<=v);

Re: D / GtkD for SQL Server

2013-10-26 Thread John Joyus
On 10/25/2013 04:04 AM, Gary Willoughby wrote: 1). Does D has any support for MSSQL? See here: http://forum.dlang.org/thread/qcxoafwuachwnnwqk...@forum.dlang.org Thanks for the link, but what I meant by MSSQL is Microsoft SQL Server. Not MySQL.

Re: How to get a substring?

2013-10-26 Thread Jesse Phillips
On Saturday, 26 October 2013 at 22:17:33 UTC, Ali Çehreli wrote: Use slices: string msg = "Hello"; string sub = msg[0 .. 2]; Yes but that works only if the string is known to contain only ASCII codes. (Otherwise, a string is a collection of UTF-8 code units.) But that isn't how substring w

Re: How to get a substring?

2013-10-26 Thread Damian
On Saturday, 26 October 2013 at 23:19:56 UTC, Namespace wrote: On Saturday, 26 October 2013 at 22:17:33 UTC, Ali Çehreli wrote: On 10/26/2013 02:25 PM, Namespace wrote: On Saturday, 26 October 2013 at 21:23:13 UTC, Gautam Goel wrote: Dumb Newbie Question: I've searched through the library refe

Re: How to get a substring?

2013-10-26 Thread Namespace
On Saturday, 26 October 2013 at 22:17:33 UTC, Ali Çehreli wrote: On 10/26/2013 02:25 PM, Namespace wrote: On Saturday, 26 October 2013 at 21:23:13 UTC, Gautam Goel wrote: Dumb Newbie Question: I've searched through the library reference, but I haven't figured out how to extract a substring from

Re: Source code of a method.

2013-10-26 Thread TheFlyingFiddle
I kind of did the same thing here in the Mockable mixin: https://github.com/nomad-software/dunit Instead of wrapping i simply extended the target class so i have access to 'super.bar()'. Then i can add the specialisation code and/or call the original method too. Hmm i never considered inherit

Re: How to get a substring?

2013-10-26 Thread Ali Çehreli
On 10/26/2013 02:25 PM, Namespace wrote: On Saturday, 26 October 2013 at 21:23:13 UTC, Gautam Goel wrote: Dumb Newbie Question: I've searched through the library reference, but I haven't figured out how to extract a substring from a string. I'd like something like string.substring("Hello", 0, 2)

Re: Source code of a method.

2013-10-26 Thread Gary Willoughby
On Saturday, 26 October 2013 at 20:38:14 UTC, TheFlyingFiddle wrote: On Saturday, 26 October 2013 at 19:04:09 UTC, Gary Willoughby wrote: On Saturday, 26 October 2013 at 16:36:35 UTC, TheFlyingFiddle wrote: Is there a way to extract the source code of a method at compiletime? Nope. What do yo

Re: How to get a substring?

2013-10-26 Thread Namespace
On Saturday, 26 October 2013 at 21:23:13 UTC, Gautam Goel wrote: Dumb Newbie Question: I've searched through the library reference, but I haven't figured out how to extract a substring from a string. I'd like something like string.substring("Hello", 0, 2) to return "Hel", for example. What met

How to get a substring?

2013-10-26 Thread Gautam Goel
Dumb Newbie Question: I've searched through the library reference, but I haven't figured out how to extract a substring from a string. I'd like something like string.substring("Hello", 0, 2) to return "Hel", for example. What method am I looking for? Thanks!

Re: Source code of a method.

2013-10-26 Thread TheFlyingFiddle
On Saturday, 26 October 2013 at 19:04:09 UTC, Gary Willoughby wrote: On Saturday, 26 October 2013 at 16:36:35 UTC, TheFlyingFiddle wrote: Is there a way to extract the source code of a method at compiletime? Nope. What do you need to do? I'm currently making an AOP framework. I use UDA's to

Re: Source code of a method.

2013-10-26 Thread Gary Willoughby
On Saturday, 26 October 2013 at 16:36:35 UTC, TheFlyingFiddle wrote: Is there a way to extract the source code of a method at compiletime? Nope. What do you need to do?

Re: Source code of a method.

2013-10-26 Thread QAston
On Saturday, 26 October 2013 at 16:36:35 UTC, TheFlyingFiddle wrote: Is there a way to extract the source code of a method at compiletime? Short and to the point answer: no.

Re: Array of struct with floating point members seg faults

2013-10-26 Thread Maxim Fomin
On Saturday, 26 October 2013 at 17:46:31 UTC, Ali Çehreli wrote: The following program seg faults: struct Point { double x; double y; } void main() { Point[1] arr; } Any combination of float and double members exhibit the same bug as long as the size of the struct is 16. I vague

Array of struct with floating point members seg faults

2013-10-26 Thread Ali Çehreli
The following program seg faults: struct Point { double x; double y; } void main() { Point[1] arr; } Any combination of float and double members exhibit the same bug as long as the size of the struct is 16. I vaguely remember seeing a similar bug before but I can't find it in bu

Source code of a method.

2013-10-26 Thread TheFlyingFiddle
Is there a way to extract the source code of a method at compiletime?

Re: selectively running unittest functions

2013-10-26 Thread Daniel Davidson
Here is a working solution: https://github.com/patefacio/d-help/blob/master/d-help/opmix/ut.d Currently it only pulls in unittests at the module level. I'm sure it will work on unittests scoped to structs/classes, I just need to figure out how to determine if a compile time named object is an

Re: selectively running unittest functions

2013-10-26 Thread Daniel Davidson
On Saturday, 26 October 2013 at 08:09:26 UTC, Dmitry Olshansky wrote: 26-Oct-2013 02:36, Daniel Davidson пишет: On Friday, 25 October 2013 at 16:43:23 UTC, Daniel Davidson wrote: On Friday, 25 October 2013 at 14:14:39 UTC, Dicebot wrote: This will work starting with 2.064: Ok. I'll keep pres

Re: selectively running unittest functions

2013-10-26 Thread Dmitry Olshansky
26-Oct-2013 02:36, Daniel Davidson пишет: On Friday, 25 October 2013 at 16:43:23 UTC, Daniel Davidson wrote: On Friday, 25 October 2013 at 14:14:39 UTC, Dicebot wrote: This will work starting with 2.064: Ok. I'll keep pressing. Here is an updated version: http://pastebin.com/g6FWsTkr The ide

Re: Just noticed something interesting in the std.allocator source...

2013-10-26 Thread evilrat
as replied, version(none) allows removing some code from build but it still parses and spew errors in it, there is also version(all) to re-enable code.