Is there an equivalent in D for C function "strstr" that return
the first occurrence of a given string within another string?
https://en.cppreference.com/w/c/string/byte/strstr
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov wrote:
I did a topic a [little
earlier](https://forum.dlang.org/thread/hfzsnagofrnlmynyz...@forum.dlang.org) about compiling a compiler for processor Geode LX800.
The bottom line is that I have a processor on which I want to
compile
On 7/29/22 13:23, pascal111 via Digitalmars-d-learn wrote:
Is there an equivalent in D for C function "strstr" that return the first occurrence of a given
string within another string?
https://en.cppreference.com/w/c/string/byte/strstr
You can use `find` from
On Friday, 29 July 2022 at 13:44:47 UTC, Salih Dincer wrote:
**Short version:**
```d
import std.string;
import std.stdio;
void find (string str, string substr) {
if(auto pos = str.indexOf(substr)) {
writefln("found the string '%s' in '%s' at position:
%s", substr, str, pos);
On Friday, 29 July 2022 at 11:23:55 UTC, pascal111 wrote:
Is there an equivalent in D for C function "strstr" that return
the first occurrence of a given string within another string?
https://en.cppreference.com/w/c/string/byte/strstr
https://dlang.org/library/std/string/index_of.html
I
**Short version:**
```d
import std.string;
import std.stdio;
void find (string str, string substr) {
if(auto pos = str.indexOf(substr)) {
writefln("found the string '%s' in '%s' at position: %s",
substr, str, pos);
} else {
writefln("the string '%s' was not found in
On Friday, 29 July 2022 at 14:14:54 UTC, pascal111 wrote:
we won't find that there is a definition for it with just two
parameters, so from where you got this new definition of this
function?!
This thread is about
[UFCS](https://tour.dlang.org/tour/en/gems/uniform-function-call-syntax-ufcs).
On Friday, 29 July 2022 at 14:14:54 UTC, pascal111 wrote:
and if I'm right, with returning back to the definitions of
"indexOf" @ https://dlang.org/phobos/std_string.html#.indexOf
we won't find that there is a definition for it with just two
parameters, so from where you got this new
On Friday, 29 July 2022 at 15:39:16 UTC, Salih Dincer wrote:
On Friday, 29 July 2022 at 14:14:54 UTC, pascal111 wrote:
we won't find that there is a definition for it with just two
parameters, so from where you got this new definition of this
function?!
This thread is about
In the example below `func` changes its `const*` argument. Does
this violates D's constness?
```d
import std;
struct S
{
string s;
void delegate(string s) update;
}
void func(const S* s)
{
writeln(*s);
s.update("func");
writeln(*s);
}
void main()
{
auto s =
I next code, we have a data type problem
"54.among(to!uint[10](y)).writeln;":
module main;
import std.stdio;
import std.string;
import std.conv;
import dcollect;
import std.math;
import std.algorithm;
int main(string[] args)
{
int[] x=[23, 34,-88, 54, -90, -34];
auto
On Friday, 29 July 2022 at 22:16:26 UTC, H. S. Teoh wrote:
This totally makes sense. Thanks for explanation!
On Friday, 29 July 2022 at 22:09:47 UTC, pascal111 wrote:
I next code, we have a data type problem
"54.among(to!uint[10](y)).writeln;":
module main;
import std.stdio;
import std.string;
import std.conv;
import dcollect;
import std.math;
import std.algorithm;
int main(string[] args)
{
On Fri, Jul 29, 2022 at 09:56:20PM +, Andrey Zherikov via
Digitalmars-d-learn wrote:
> In the example below `func` changes its `const*` argument. Does this
> violates D's constness?
>
> ```d
> import std;
>
> struct S
> {
> string s;
>
> void delegate(string s) update;
> }
>
>
On Friday, 29 July 2022 at 22:12:54 UTC, Andrey Zherikov wrote:
On Friday, 29 July 2022 at 22:09:47 UTC, pascal111 wrote:
I next code, we have a data type problem
"54.among(to!uint[10](y)).writeln;":
module main;
import std.stdio;
import std.string;
import std.conv;
import dcollect;
import
On Friday, 29 July 2022 at 22:09:47 UTC, pascal111 wrote:
Error message:
"hello.d|19|error: only one index allowed to index void|"
```d
import std.stdio;
void main() {
int[] y = [-90, -88, -34]; /* ok but no
compile y.to!uint[10] */
enum len = 10;
y.length = len;
int[len] v = y;
On Fri, Jul 29, 2022 at 10:32:11PM +, pascal111 via Digitalmars-d-learn
wrote:
[...]
> I want searching for value 54 in array y "54.among(y).writeln;", but
> it seems compiler complaints because the data type is "int[]", so I
> tried to convert "y" to "uint[]".
You're using the wrong
FYI, you can use the markdown code tag so your code is properly
rendered when viewed from the forums (make sure to tick the
"Enable Markdown", right next to Send)
```
```D
void my_function()
{
}
```
```
it'll be rendered like this:
```D
void my_function()
{
}
```
On Friday, 29 July 2022 at 21:56:20 UTC, Andrey Zherikov wrote:
In the example below `func` changes its `const*` argument. Does
this violates D's constness?
It's smart to use `delegate`, but `immutable` doesn't necessarily
mean `const`. So if we use `const char`:
```d
struct S
{
On Friday, 29 July 2022 at 23:15:14 UTC, Salih Dincer wrote:
It's smart to use `delegate`, but `immutable` doesn't
necessarily mean `const`. So if we use `const char`:
```d
struct S
{
char s;
void delegate(char s) update;
}
```
Pardon
I forgot the assert test, also writing const
On Saturday, 30 July 2022 at 04:06:28 UTC, Murilo wrote:
Hi guys, I need to create a Telegram bot in D, does anyone here
know how to do it? Is it possible to do it using arsd?
https://core.telegram.org/bots/api
The Bot API is an HTTP-based interface created for developers
keen on building
Hi guys, I need to create a Telegram bot in D, does anyone here
know how to do it? Is it possible to do it using arsd?
so basically you have to do http-client programming
also there's some outdated tg packages in repo
https://code.dlang.org/search?q=telegram
23 matches
Mail list logo