You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: eBook/07.5.md
+30-30
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,28 @@
1
-
# 7.5 Files
1
+
# 7.5 Archivos
2
2
3
-
File is must-have object in every single computer device, and web applications also have many usage with files. In this section, we're going to learn how to operate files in Go.
3
+
El archivo se debe-tener como un objeto unico en cada dispositivo informático y tambien en aplicaciones web se tiene mucho uso. En esta sección, vamos a aprender a manejar archivos en Go.
4
4
5
-
## Directories
5
+
## DirectoriosDirectories
6
6
7
-
Most of functions of file operations is in package `os`, here are some functions about directories:
7
+
La mayor parte de las funciones de las operaciones de archivos estan en el package `os`, he aquí algunas funciones sobre directorios:
8
8
9
9
- func Mkdir(name string, perm FileMode) error
10
10
11
-
Create directory with `name`, `perm` is permission, like 0777.
11
+
Crear directorio con `name`, `perm`, 0777.
12
12
13
13
- func MkdirAll(path string, perm FileMode) error
14
14
15
-
Create multiple directories according to `path`, like `astaxie/test1/test2`.
15
+
Crear varios directorios de acuerdo al `path`, como `astaxie/test1/test2`.
16
16
17
17
- func Remove(name string) error
18
18
19
-
Remove directory with `name`, it returns error if it's not directory or not empty.
19
+
Remueve el directorio `name`, devuelve error si no es directorio o no está vacío.
20
20
21
21
- func RemoveAll(path string) error
22
22
23
-
Remove multiple directories according to `path`, it will not be deleted if `path` is a single path.
23
+
Eliminar varios directorios de acuerdo `path` , no se borrará si camino es un camino único.
Copy file name to clipboardExpand all lines: eBook/07.6.md
+15-15
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
-
# 7.6 Strings
1
+
# 7.6 cadenas de texto
2
2
3
-
Almost everything we see is represented by string, so it's a very important part of web development, including user inputs, database access; also we need to split, join and convert strings in many cases. In this section, we are going to introduce packages `strings` and `strconv`in Go standard library.
3
+
Casi todo lo que vemos está representado por string, por lo que es una parte muy importante del desarrollo web, incluyendo las entradas de usuario, acceso a bases de datos; También tenemos que dividir, unir y convertir cadenas en muchos casos. En esta sección, vamos a introducir los paquetes `strings` and `strconv`en Go biblioteca estándar.
4
4
5
5
## strings
6
6
7
-
Following functions are from package `strings`, more details please see official documentation:
7
+
Las siguientes funciones son del package `strings`, más detalles, ver la documentación oficial:
8
8
9
9
- func Contains(s, substr string) bool
10
10
11
-
Check if string `s` contains string `substr`, returns boolean value.
11
+
Compruebe si la cadena `s` contiene string `substr`, devuelve el valor booleano.
12
12
13
13
fmt.Println(strings.Contains("seafood", "foo"))
14
14
fmt.Println(strings.Contains("seafood", "bar"))
@@ -22,15 +22,15 @@ Following functions are from package `strings`, more details please see official
22
22
23
23
- func Join(a []string, sep string) string
24
24
25
-
Combine strings from slice with separator `sep`.
25
+
Combina strings de un slice con el separador `sep`.
26
26
27
27
s := []string{"foo", "bar", "baz"}
28
28
fmt.Println(strings.Join(s, ", "))
29
29
//Output:foo, bar, baz
30
30
31
31
- func Index(s, sep string) int
32
32
33
-
Find index of `sep` in string `s`, returns -1 if it's not found.
33
+
Encuentra el index `sep` en el string `s`, retorna -1 si no lo encuentra.
34
34
35
35
fmt.Println(strings.Index("chicken", "ken"))
36
36
fmt.Println(strings.Index("chicken", "dmr"))
@@ -39,14 +39,14 @@ Following functions are from package `strings`, more details please see official
39
39
40
40
- func Repeat(s string, count int) string
41
41
42
-
Repeat string `s` with `count` times.
42
+
Repite el string `s` con `count` veces.
43
43
44
44
fmt.Println("ba" + strings.Repeat("na", 2))
45
45
//Output:banana
46
46
47
47
- func Replace(s, old, new string, n int) string
48
48
49
-
Replace string `old` with string `new` in string `s`, `n` means replication times, if n less than 0 means replace all.
49
+
Reemplaza el string `old` con el string `new` en el string `s`, `n` ignifica tiempos de replicación, si n es menor que 0 significa reemplazar todos.
In this chapter, we introduced some text process tools like XML, JSON, Regexp and template. XML and JSON are data exchange tools, if you can represent almost all kinds of information though these two formats. Regexp is a powerful tool for searching, replacing, cutting text content. With template, you can easily combine dynamic data with static files. These tools are all useful when you develop web application, I hope you understand more about processing and showing content.
3
+
En este capítulo, presentamos algunas herramientas de proceso de texto como XML, JSON, Regexp y plantilla. XML y JSON son herramientas de intercambio de datos, si se puede representar a casi todo tipo de información, aunque estos dos formatos. Regexp es una poderosa herramienta para buscar, reemplazar, cortar el contenido del texto. Con la plantilla, usted puede combinar fácilmente datos dinámicos con archivos estáticos. Estas herramientas son útiles cuando se desarrollan aplicaciones web, espero que entienda más sobre el procesamiento y la presentación de contenidos..
0 commit comments