Search 5,000,000+ questions and answers.

Frequently Asked Questions

How do I read a String/int/boolean/etc from the keyboard?

Java Programmer's FAQ
The easiest way is to pick up the source for the 100% pure Java class EasyIn from http://www.afu.com/ (same place as this FAQ) Compile it with your code and use it like this: EasyIn easy = new EasyIn(); int i = easy.readInt(); // gets an int from System.in boolean b = easy.readBoolean(); // gets a boolean from System.in double d = easy.readDouble(); // gets a double from System.in ... etc.
Related Questions

How can I convert from string to int ?

C++ corner
You want to make a function that converts from a type to another. Like from std::string to int, or the other way around. This can be done using std::stringstream and insertion / extraction operators. Just as above, templates will prove of great help: Its usage is not as straightforward as the above explained max template. Normally, you would want to call it like "int value = lexical_cast( myStdString );". There is, however, a problem.
Related Questions

FAQ - CPP
The simplest way is to use the function int std::atoi(const char*) declared in cstdlib. For example, std::atoi("31337") returns 31337. Alternatively, you can use std::strtol() or std::strtoul(). These functions provide more functionality such as the ability to convert hexadecimal or octal number strings, and are also declared in cstdlib.
Related Questions

How do I convert from int to string?

FAQ - CPP
Converting from int to string is a little more complicated than converting a string to int. There are no standard C++ functions for this, but there is a way to do it using standard stringstreams. The class stringstream is declared in header sstream and is used like this: std::stringstream ss; std::string str; ss << 31337; ss >> str;
Related Questions

What is a "Boolean search string"?

Frequently Asked Questions
A Boolean text string (BTS) consists of one or more words separated by Boolean operators -- AND, OR, and NOT represented by &, |, and ^, respectively, in search strings created by the user. (See item 1, page 16.)
Related Questions

How can I read a single character from the keyboard without waiting for a newline?

Infrequently Asked Questions in comp.lang.c
The buffer is normally at ''&main - 0100''. Lower if you have more than 256 characters of typeahead.
Related Questions

How do I convert a string to an int etc?

FAQ for the microsoft.public.languages.csharp newsgroup
In general, when you want to convert from one type to another, the first class to look at is System.Convert. It has a load of static methods which are likely to help you. If you're converting from a String, you could also check whether the type that you want to convert to has a Parse method or something similar - for instance, I usually use DateTime.ParseExact to convert from a String to a DateTime.
Related Questions

Q. How do I convert from string to int?

C++ FAQs - General
The simplest way is to use the function int std::atoi(const char*) declared in cstdlib. For example, std::atoi("31337") returns 31337. Alternatively, you can use std::strtol() or std::strtoul(). These functions provide more functionality such as the ability to convert hexadecimal or octal number strings, and are also declared in cstdlib.
Related Questions

Q. How do I convert from int to string?

C++ FAQs - General
Converting from int to string is a little more complicated than converting a string to int. There are no standard C++ functions for this, but there is a way to do it using standard stringstreams. The class stringstream is declared in header sstream and is used like this:
Related Questions

Sect. 18) How do I convert a String to an int?

Java Programmer's FAQ - Part D
There are several ways. The most straightforward is: String myString = numString.trim(); int i = Integer.parseInt(myString); long l = Long.parseLong(myString) or String myString = numString.trim(); i = Integer.parseInt(myString,myIntRadix); Note 1: There is a gotcha with parseInt - it will throw a NumberFormatException for String values in the range "80000000" to "ffffffff". You might expect it to interpret them as negative, but it does not. The values have to be "-80000000" .
Related Questions

Sect. 18) How do I convert an int to a string?

Java Programmer's FAQ - Part D
Try any of these: String s = String.valueOf(i); or String s = Integer.toString(i); or String s = Integer.toString(i, radix); or // briefer but may result in extra object allocation. String s = "" + i; Note: There are similar classes for Double, Float, Long, etc.
Related Questions

How can I show an int as a binary number - a string of 1s and 0s?

FAQ for the microsoft.public.languages.csharp newsgroup
The Convert class has an overload of the static ToString() method that takes two ints and returns a string populated with the number in the specified base. For instance, calling Convert.ToString(128, 2) will return "10000000".
Related Questions

How to convert an int to a char array or C++ string?

Tech Talk about C++ and C Issues / Comeau C++ and C FAQ
How to add a float (or "any" type really) to the end of a C++ string? Unlike routines like atoi mentioned in the previous question, there is no direct routine such as itoa available. However, similar to the string I/O routines in the previous question, one can do this: #include <stdio.h> // cstdio in C++ // ..
Related Questions

Can QEngine script support string/int variable?

AdventNet QEngine - Frequently Asked Questions
Yes, QEngine supports string/int variables usage in the script. This will help you to use the business logics of your application to validate the results shown in your pages. For e.g., you can define a variable like below variableA=25 variableB=”Use this string” You can also cast a string variable to int for using it in a loop structure or somewhere else like below. variableA=”25” // int value stored as a string variable.
Related Questions

Can QEngine support to manipulate any string / int data inside the script?

AdventNet QEngine - Frequently Asked Questions
Yes, you can manipulate any string/int data inside the script. You can use + - * / for int value manipulations. For string manipulation QEngine provides you many functions like Java
Related Questions

How do I convert a string to a double or int? What plays the role of atof and atoi in C#?

Windows Forms FAQ - Windows Forms from MFC
You use static members of the Convert class found in the System namespace to handle conversions in the .NET framework.
Related Questions

How can I convert an INT into CHAR*/STRING or vice versa?

Beginner FAQ - GPWiki
This is something you do a lot in programming and pretty much every language makes it easy to convert between types. You may have already printed integers to the console with COUT or PRINTF, which of course needs to be converted to a string first. Converting numbers to strings is done in a similar way. Boost is a C++ library that can help you with problems like these and many others.
Related Questions

Why does (read-from-string "foobar" :start 3) return FOOBAR instead of BAR?

Frequently Asked Questions for comp.lang.lisp
READ-FROM-STRING string &OPTIONAL eof-error-p eof-value &KEY :start :end :preserve-whitespace When a function takes both types of arguments, all the optional arguments must be specified explicitly before any of the keyword arguments may be specified. In the example above, :START becomes the value of the optional EOF-ERROR-P parameter and 3 is the value of the optional EOF-VALUE parameter. To get the desired result, you should use (read-from-string "foobar" t nil :start 3).
Related Questions

What is the 'Read-only Community String'?

SNMP FAQs
The SNMP Read-Only Community String is like a password. It is sent along with each SNMP Get-Request and allows (or denies) access to device. Most network vendors ship their equipment with a default password of "public". (This is the so-called "default public community string".) Many network administrators will change the community string to keep intruders from getting information about the network setup. This is a good idea.
Related Questions

Do you do Boolean?

Grapeshot - Developer - FAQs
Grapeshot supports Boolean searching across all fields, as well as field specific queries, with AND, OR, NOT and other familiar Boolean operands. Grapeshot indexes can hold complete positional information of words inside a source document, thereby aiding proximity and phrase searching. Grapeshot provides a combination of advanced search techniques with a commitment to support traditional approaches to IR.
Related Questions

How do I view the results of a "Search" after I enter a term or a Boolean search string?

Frequently Asked Questions
Click on the [Hits] button to see the results of the last search. If no search has been requested, you will be prompted to enter a search. After executing a single term or a Boolean text search, you can move forward or backward through the hits list by clicking the [Next] or [Prev] buttons, respectively, under the [Hits] button. The [Hits] button will summarize the total hits.
Related Questions

What clefs must a string player be able to read?

CMNC FAQs.
That depends on what instrument you play. Violins only have to deal with treble. An intermediate cello player should be able to read and play both bass and tenor clef, and being able to read treble cleff is highly desirable. An advanced cello player should be able to read and play from the bass, tenor, treble, and transposed treble clef (reading the treble clef and playing an octave down). A viola player should be able to read and play from both the alto and treble clefs.
Related Questions

What is a Boolean Network or NK model ?

Self-Organizing Systems FAQ for Usenet newsgroup comp.theory...
Taking a collection (N) of logic gates (AND, OR, NOT etc.) each with K inputs and interconnecting them gives us a Boolean Network. Depending upon the number of inputs (K) to each gate we can generate a collection of possible logic functions that could be used. By allocating these to the nodes (N) at random we have a Random Boolean Network (RBN - also called a Kauffman Net or the Kauffman Model) and this can be used to investigate whether organization appears for different sets of parameters.
Related Questions

Do you string racquets?

Rocky Mountain Racquet Specialists - Frequently Asked Questi...
We string racquets for tennis, racquetball, squash and badminton. String prices vary from $20-$60 installed and customization work is also available. Please see our string page for more information.
Related Questions

How often should I re-string my racquet?

Rocky Mountain Racquet Specialists - Frequently Asked Questi...
The rule of thumb is to re-string your racquet as many times a year as you play in a week. Therefore, if you play three times a week, you should re-string your racquet every four months. Factors such as tennis elbow will effect how often you re-string your racquet. Please see our tips page for more information.
Related Questions

What is a format string?

Digitizing Frequently Asked Questions (FAQ) for MicroScribe ...
A format string is used by MicroScribe Utility Software (MUS) to format data coming from the MicroScribe so that a 3rd party application can accept and use the data. A set of standard format strings for popular software packages is included with MUS, and a user can also create custom format strings. See the MUS help file for more information on format strings.
Related Questions

How do I split a string?

Frequently Asked Questions for comp.lang.lisp
There is no 'right' answer to this question; many lisp programmers have rolled their own solution in the past, and others are of the view that it should never be necessary, as long as all sequence functions are used with consistent :start and :end arguments. However, a community-based 'standard' was developed in June/July 2001 on comp.lang.lisp; known as SPLIT-SEQUENCE (formerly PARTITION), it works as follows in its simplest form: split-sequence #\Space "A stitch in time saves nine.
Related Questions

How do I find/configure the SNMP read-only community string for my devices?

Klir - Frequently Asked Questions
An SNMP read-only community string/name acts as a password to access device or application data. Refer to your device, operating system or application documentation for instructions on how to configure SNMP. The SNMP read-only community string(s) set on your devices (e.g. public) must be entered in the Find/Add Devices screen in order for them to be added to the system for monitoring.
Related Questions

Got A Question? Ask Our Community!


More Questions >>

© Copyright 2007-2008 QueryCAT
About • Webmasters • Contact