Is there any other way to do a simple user input into integer
variables without using std.conv?
On 11/08/2017 09:19 AM, Namal wrote:
Is there any other way to do a simple user input into integer variables
without using std.conv?
import std.stdio;
void main() {
int i;
readf(" %s", &i);// You can use %d as well
// You can wrap readf in a function templ
Is there a fast way to get a number out of a text input?
Like getting '1.5' out of 'sdaz1.5;['.
Here's what I have at the moment:
string processValue(string s) {
string ns;
foreach(c; s) {
import std.stdio;
I am somewhat new to D, and I am trying to receive user input,
like this, with a prompt:
string str;
writeln("Enter a string: ");
str = readln;
writeln(str);
However, the prompt appears after I enter the input; any reason
why?
I've trawled the internet
Hy, i'm new @ D and i come from python.
Sorry for my engish, i understand good, but i write like a cow
spanish.
I make a little programm to add human's name and age and a
function to write out alls humans in the list.
Here is the source:
http://dpaste.dzfl.pl/0a0da462225d
The problem is, i
On Wednesday, 14 October 2015 at 07:14:45 UTC, Joel wrote:
Is there a fast way to get a number out of a text input?
Like getting '1.5' out of 'sdaz1.5;['.
Here's what I have at the moment:
string processValue(string s) {
string ns;
On 10/14/2015 12:14 AM, Joel wrote:
Is there a fast way to get a number out of a text input?
Like getting '1.5' out of 'sdaz1.5;['.
Here's what I have at the moment:
string processValue(string s) {
string ns;
foreach(c; s) {
if
Thanks guys. I did think of regex, but I don't know how to learn
it.
On Saturday, 29 April 2017 at 21:09:13 UTC, fred wrote:
import std.stdio;
I am somewhat new to D, and I am trying to receive user input,
like this, with a prompt:
string str;
writeln("Enter a string: ");
str = readln;
writeln(str);
However, the prompt appears after I enter the
On Saturday, 29 April 2017 at 21:18:27 UTC, cym13 wrote:
On Saturday, 29 April 2017 at 21:09:13 UTC, fred wrote:
import std.stdio;
I am somewhat new to D, and I am trying to receive user input,
like this, with a prompt:
string str;
writeln("Enter a string: ");
str = readln;
w
hmm the paste is away ?!? here i post my source one more time.
[code]
import std.stdio;
import std.string;
struct Human {
string name;
ushort age;
};
void print_human_list(Human[] human_list){
foreach(human; human_list){
writeln(human.name);
writeln(human.age);
On 4/23/15 1:17 PM, kerze wrote:
The problem is, it writes instant "Name: Age:" at the standart output.
readf reads the element from the stream, and NOTHING MORE, it leaves the
newline on the stream.
So the next readf then reads the newline as a string. You can fix this
by using readf(" %s"
The paste is still there.
readf leaves the \n from pressing enter in stdin, which gets read
by the next function that's accessing it.
I answered a similiar question in another thread:
http://forum.dlang.org/post/jwxfaztgsyzwqpzaj...@forum.dlang.org
I see two other mistakes in your code as well:
Willkommen in der D Community. ;)
So many Thanks @Steven and Jacques, answer's more than a only;
"do this" ;)
On Thursday, 23 April 2015 at 17:18:01 UTC, kerze wrote:
Hy, i'm new @ D and i come from python.
Sorry for my engish, i understand good, but i write like a cow
spanish.
I make a little programm to add human's name and age and a
function to write out alls humans in the list.
Here is the sour
It also works:
-
import std.conv;
import std.stdio;
import std.string;
struct Human {
string name;
ushort age;
}
void print_human_list(Human[] human_list) {
foreach(human; human_list) {
writeln(human.name);
writeln(human.age);
Hi,
Is there a way to transform user input string to a regular
expression? For example, I want to write a `grep`-like program
```
mygrep -E '/pattern/i' file.txt
```
and here the user's parameter `/pattern/i` would be converted to
a Regex object.
Fyi, in Ruby, `to_regexp`
On Saturday, 16 September 2017 at 03:18:31 UTC, Ky-Anh Huynh
wrote:
Is there a way to transform user input string to a regular
expression? For example, I want to write a `grep`-like program
import std.regex;
auto re = regex(user_pattern, user_flags);
You'll probably want to split it o
On Saturday, 16 September 2017 at 03:23:14 UTC, Adam D. Ruppe
wrote:
On Saturday, 16 September 2017 at 03:18:31 UTC, Ky-Anh Huynh
wrote:
Is there a way to transform user input string to a regular
expression? For example, I want to write a `grep`-like program
import std.regex;
auto re = regex
Wondering if this is possible? Ask a user at input and wait for
response:
write("Is the sky blue? ");
readf!" %s\n"(response);
If the user's response is correct, I'd like to change the color
of provided response to indicate it was correct then advance to
the next line and ask a different ques
On 4/6/23 4:01 AM, anonymouse wrote:
Wondering if this is possible? Ask a user at input and wait for response:
write("Is the sky blue? ");
readf!" %s\n"(response);
If the user's response is correct, I'd like to change the color of
provided response to indicate it was correct then advance to th
On Thursday, 6 April 2023 at 14:51:43 UTC, Steven Schveighoffer
wrote:
On 4/6/23 4:01 AM, anonymouse wrote:
Wondering if this is possible?
[snip]
You need to use a terminal-control library, such as
`arsd.terminal`
https://github.com/adamdruppe/arsd/blob/master/terminal.d
-Steve
That works
I'd like to filter Treeview data according to user input. How
should I do that?
When I run this program it gives segmentation fault error.
import gtk.Main;
import gtk.MainWindow;
import gtk.Box;
import gtk.Entry;
import gtk.EditableIF;
import gtk.TreeModelFilter;
import gtk.TreeView;
i
On 01/17/2017 01:25 AM, Erdem wrote:
> void main(string[] args)
> {
> Main.init(args);
> new MyWindow();
> Main.run();
> }
I have no experience with Gtkd but the code inside main looks
fundamentally wrong. One would expect you to do something with the
MyWindow object:
auto w
On Tuesday, 17 January 2017 at 19:07:21 UTC, Ali Çehreli wrote:
On 01/17/2017 01:25 AM, Erdem wrote:
> void main(string[] args)
> {
> Main.init(args);
> new MyWindow();
> Main.run();
> }
I have no experience with Gtkd but the code inside main looks
fundamentally wrong. One would ex
25 matches
Mail list logo