본문 바로가기

전체 글345

[Excel] OFFSET Function OFFSET 함수는 주어진 표에서 원하는 행과 열에 위치한 셀의 값을 얻는 함수입니다. OFFSET(reference, rows, cols, [height], [width]) reference에 표의 좌상단을 넣어주고, 원하는 행과 열을 각각 rows와 cols에 명시해줍니다. 추가로 표의 크기를 height와 width에 넣어줄 수도 있습니다. Usage 2020. 11. 4.
[Go] User-Defined Type Primitive Type based User-Defined Type type liters float64 type gallons float64 func main() { gasoline := liters(12.5) diesel := gallons(32.7) fmt.Println(gasoline, diesel) // 12.5 32.7 } You can create your own type based on primitive type. When converting a type, Go considers only the value itself. fmt.Println(gallons(liters(3.14))) // 3.14 So this example is not wrong, because they are all th.. 2020. 11. 2.
[Go] Package bufio Package bufio implements buffered I/O. Methods type Scanner 더보기 NewScanner NewScanner returns a new Scanner to read from r. func NewScanner (r io.Reader) *Scanner Err Err returns the first non-EOF error that was encountered by the Scanner. func (s *Scanner) Err() error Scan Scan advances the Scanner to the next token, which will then be available through the Bytes or Text method. It returns fals.. 2020. 10. 31.
[Go] Package errors Package errors implements functions to manipulate errors. Methods New New returns an error that formats as the given text. Each call to New returns a distinct error value even if the text is identical. func New(text string) error Usages package main import ( "errors" "log" ) func main() { err := errors.New("error: my error") if err != nil { log.Fatal(err) } } // error: my error 2020. 10. 29.
[Go] Package math Package math Package math provides basic constants and mathematical functions. Package rand Package rand implements pseudo-random number generators. Methods Seed Seed uses the provided seed value to initialize the default Source to a deterministic state. Seed values that have the same remainder when divided by 2^31 - 1 generate the same pseudo-random sequence. Seed, unlike the Rand.Seed method, .. 2020. 10. 27.
[Go] Package strconv Package strconv implements conversions to and from string representations of basic data types. Methods Atoi Atoi equivalent to ParseInt(s, 10, 0), converted to type int. func Atoi(s string) (int, error) Itoa Itoa is equivalent to FormatInt. func Itoa(i int) string ParseBool, ParseUInt, ParseInt, ParseFloat ParseBool, ParseUInt, ParseInt, and ParseFloat convert strings to values. func ParseBool(s.. 2020. 10. 26.
[Go] Package strings Package strings implements simple functions to manipulate UTF-8 encoded strings. Methods TrimSpace TrimSpace returns a slice of the string, with all leading and trailing white space removed, as defined by Unicode. func TrimSpace(s string) string Usages package main import ( "fmt" "strings" ) func main() { greeting := "\n Hi, nice to meet you \t\n" fmt.Println(strings.TrimSpace(greeting)) // Hi, .. 2020. 10. 26.
[Go] Basic Go is a statically typed language. Let me show you a very default Go program. package main import "fmt" func main() { fmt.Println("Hello, Go!") } The first line declares which package to use. We run the program directly in the terminal, so the main package is needed. The next line imports fmt package. The example program prints the message through Println function in the fmt package. Then finall.. 2020. 10. 26.
[TypeScript] Type Inference TypeScript provides the type inference. const b = true; console.log(typeof b); // boolean const n = 3; console.log(typeof n); // number const f = 3.14; console.log(typeof f); // number const s = 'Hello'; console.log(typeof s); // string Best Common Type When a type inference is made from several expressions, the types of those expressions are used to calculate a 'best common type'. When no best .. 2020. 10. 25.