Thread overview |
---|
April 24, 2020 What is the best way to refer to itself when obtaining Substring of a literal? | ||||
---|---|---|---|---|
| ||||
I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable? example: writeln("Hello Word!"[x.indexOf(" "), $]); |
April 25, 2020 Re: What is the best way to refer to itself when obtaining Substring of a literal? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marcone | On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote:
> I don't want to use lambda.
> I don't want create variable.
>
> What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable?
>
>
> example:
>
> writeln("Hello Word!"[x.indexOf(" "), $]);
no way
|
April 25, 2020 Re: What is the best way to refer to itself when obtaining Substring of a literal? | ||||
---|---|---|---|---|
| ||||
Posted in reply to 9il | On Saturday, 25 April 2020 at 01:32:54 UTC, 9il wrote: > On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote: >> I don't want to use lambda. >> I don't want create variable. >> >> What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable? >> >> >> example: >> >> writeln("Hello Word!"[x.indexOf(" "), $]); > > no way alias Seq = AliasSeq!("Hello Word!"); // it isn't a variable, lambda or enum writeln(Seq[0][Seq[0].indexOf(" "), $]); looks weird anyway |
April 25, 2020 Re: What is the best way to refer to itself when obtaining Substring of a literal? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marcone | On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote:
> I don't want to use lambda.
> I don't want create variable.
>
> What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable?
>
>
> example:
>
> writeln("Hello Word!"[x.indexOf(" "), $]);
Maybe u want this?
import std.algorithm: find;
import std.stdio: writeln;
"Hello World".find(" ").writeln;
|
April 25, 2020 Re: What is the best way to refer to itself when obtaining Substring of a literal? | ||||
---|---|---|---|---|
| ||||
Posted in reply to SrMordred | On Saturday, 25 April 2020 at 03:47:33 UTC, SrMordred wrote:
> On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote:
>> I don't want to use lambda.
>> I don't want create variable.
>>
>> What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable?
>>
>>
>> example:
>>
>> writeln("Hello Word!"[x.indexOf(" "), $]);
>
> Maybe u want this?
>
> import std.algorithm: find;
> import std.stdio: writeln;
>
> "Hello World".find(" ").writeln;
I don't want this, I just make a simple example.
|
April 25, 2020 Re: What is the best way to refer to itself when obtaining Substring of a literal? | ||||
---|---|---|---|---|
| ||||
Posted in reply to 9il | On Saturday, 25 April 2020 at 01:32:54 UTC, 9il wrote:
> On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote:
>> I don't want to use lambda.
>> I don't want create variable.
>>
>> What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable?
>>
>>
>> example:
>>
>> writeln("Hello Word!"[x.indexOf(" "), $]);
>
> no way
What a pity! If Dlang have $ to indicate end of string. I think that is good some keyword to indicate the string itself.
|
Copyright © 1999-2021 by the D Language Foundation