user-input

User Input Validation Using Character Array in C++

六眼飞鱼酱① 提交于 2020-02-08 10:44:10
问题 I am creating a c++ program to validate book ID using function in c++. The program must return 1 if the input is valid and 0 if the input is invalid. INPUT Pattern: "123-AB-12345" This will be considered as a valid input. The valid input is: (a) Total characters must be 12 (b) First three characters must be integers from 1 to 9 each. (c) 4th and 7th characters must be hiphen "-". (d) Last 5 characters must be integers from 1 to 9 each. I tried the following way but I am not getting the

Unfocus a TextInput in React Native

喜欢而已 提交于 2020-01-31 06:11:45
问题 I'm building an Android app with React Native. How can you force a TextInput to "unFocus", meaning the cursor is blinking inside the text field. There are functions for isFocused() and onFocus() , but how do I actually get the text field to give up focus. You would think it does so automatically once I hit enter, but that's not the case. import React, {Component} from 'react'; import { AppRegistry, Text, View, StyleSheet, TextInput, TouchableOpacity} from 'react-native'; var SHA256 = require(

JOptionPane Input to int

戏子无情 提交于 2020-01-29 04:55:07
问题 I am trying to make a JOptionPane get an input and assign it to an int but I am getting some problems with the variable types. I am trying something like this: Int ans = (Integer) JOptionPane.showInputDialog(frame, "Text", JOptionPane.INFORMATION_MESSAGE, null, null, "[sample text to help input]"); But I am getting: Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer Which sounds logical yet, I cannot think of another way to make this

When is it best to sanitize user input?

可紊 提交于 2020-01-26 23:55:32
问题 User equals untrustworthy. Never trust untrustworthy user's input. I get that. However, I am wondering when the best time to sanitize input is. For example, do you blindly store user input and then sanitize it whenever it is accessed/used, or do you sanitize the input immediately and then store this "cleaned" version? Maybe there are also some other approaches I haven't though of in addition to these. I am leaning more towards the first method, because any data that came from user input must

user input to create object

核能气质少年 提交于 2020-01-22 02:11:52
问题 I'm trying to create a new object using a user input. I tried assigning the user input to variables but don't know how to add the variables to the new object in the when I declare the new object. This is just the part of my code that i need help with. part i need help with is line 8. i know i can just put something random and when i use my set methods it will overwrite but that's not what I want. thank you in advance Scanner input = new Scanner(System.in); System.out.println("Enter the name

Limiting Python input strings to certain characters and lengths

不想你离开。 提交于 2020-01-19 04:58:05
问题 I just started learning my first real programming language, Python. I'd like to know how to constrain user input in a raw_input to certain characters and to a certain length. For example, I'd like to show an error message if the user inputs a string that contains anything except the letters a-z , and I'd like to show one if the user inputs more than 15 characters. The first one seems like something I could do with regular expressions, which I know a little of because I've used them in

Cannot input Chinese in iOS Simulator

余生长醉 提交于 2020-01-16 19:49:31
问题 My iOS Simulator is Version 6.0 (358.4) . I have already added Chinese Input via Settings -> General -> Keyboard . And the International Language is also Simplified Chinese. However, I still cannot input Chinese in my iOS Simulator. It only shows the English character instead of Chinese character. 回答1: I think you have to switch to chinese input on simulator by click the 'earch' icon on the bottom left of screen. 回答2: Condition to input Chinese in simulator is, to set a Chinese region, or to

Cannot input Chinese in iOS Simulator

℡╲_俬逩灬. 提交于 2020-01-16 19:49:11
问题 My iOS Simulator is Version 6.0 (358.4) . I have already added Chinese Input via Settings -> General -> Keyboard . And the International Language is also Simplified Chinese. However, I still cannot input Chinese in my iOS Simulator. It only shows the English character instead of Chinese character. 回答1: I think you have to switch to chinese input on simulator by click the 'earch' icon on the bottom left of screen. 回答2: Condition to input Chinese in simulator is, to set a Chinese region, or to

How to make GUI wait for user input? [duplicate]

做~自己de王妃 提交于 2020-01-16 19:04:05
问题 This question already has an answer here : How to stop Java from running the entire code with out waiting for Gui input from The user (1 answer) Closed 2 years ago . I'm a rather basic programmer who has been assigned to make a GUI program without any prior experience with creating a GUI. Using NetBeans, I managed to design what I feel the GUI should look like, and what some of the buttons should do when pressed, but the main program doesn't wait for the user's input before continuing. My

How to make GUI wait for user input? [duplicate]

99封情书 提交于 2020-01-16 19:02:06
问题 This question already has an answer here : How to stop Java from running the entire code with out waiting for Gui input from The user (1 answer) Closed 2 years ago . I'm a rather basic programmer who has been assigned to make a GUI program without any prior experience with creating a GUI. Using NetBeans, I managed to design what I feel the GUI should look like, and what some of the buttons should do when pressed, but the main program doesn't wait for the user's input before continuing. My