For example,
package main import ( "flag" "fmt" "os" "strconv" ) func main() { flag.Parse() s := flag.Arg(0) // string to int i, err := strconv.Atoi(s) if err != nil { // handle error fmt.Println(err) os.Exit(2) } fmt.Println(s, i) }
Related Posts:
- What is lexicographical order?
- Regex not operator
- working of \n in python [duplicate]
- Regex not operator
- Extract a substring using PowerShell
- Extract substring in Bash
- Regex not operator
- What is the difference between \r\n, \r, and \n? [duplicate]
- How to convert an int value to string in Go?
- string to string array conversion in java
- What is the difference between \r\n, \r, and \n? [duplicate]
- Regex how to match an optional character
- How to remove punctuation in python?
- String variable interpolation Java [duplicate]
- How do I properly compare strings in C?
- How to remove .html from URL?
- What is the difference between a “line feed” and a “carriage return”?
- How to convert an int to string in C?
- Python: TypeError: cannot concatenate ‘str’ and ‘int’ objects
- Ignoring upper case and lower case in Java
- How to replace all double quotes to single quotes using jquery?
- Convert character to ASCII numeric value in java
- What does strcmp() exactly return in C?
- Generate random string/characters in JavaScript
- “[ ]” vs. “[[ ]]” in Bash shell
- How to trim whitespace from a Bash variable?
- How to get the filename without the extension from a path in Python?
- sprintf like functionality in Python
- C – The %x format specifier
- Lua string.format options
- n-grams in python, four, five, six grams?
- Convert java.util.Date to String
- Alphabet range in Python
- Reading a file line by line in Go
- How to trim whitespace from a Bash variable?
- What is the difference between ‘ and ” in JavaScript?
- Center text in fixed-width field with stream manipulators in C++
- C# – Illegal characters in path
- \n or \n in php echo not print [duplicate]
- Mips how to store user input string
- PadLeft function in T-SQL
- bash : Bad Substitution
- String.format() to format double in Java
- How to assign multiple lines string in Powershell Console
- LC-3 STR with R1 as offset
- Lua read beginning of a string
- Replace multiple strings in one gsub() or chartr() statement in R?
- How do I print my Java object without getting “SomeType@2f92e0f4”?
- How can I process each letter of text using Javascript?
- PHP to write Tab Characters inside a file?
- Haskell: Converting Int to String
- Passing string to a function in C – with or without pointers?
- Lua String replace
- Trim a string in C [duplicate]
- How to remove first character from C-string?
- Standard function to replace character or substring in a char array?
- Difference between char* and char** (in C)
- Extract filename and extension in Bash
- Meaning of #{ } in Ruby?
- Taking a new line using printf in java? Is %n correct?
- How to count instances of character in SQL Column