Permalink
Browse files

Fix conversions for rune type

  • Loading branch information...
1 parent 43620b6 commit 1acf43c314aa1ce1d2fd7152e95b5d4ea8f3f424 @miekg committed May 10, 2012
Showing with 16 additions and 12 deletions.
  1. +4 −1 ex-packages/ex-stack-package.tex
  2. +1 −1 go-basics.tex
  3. +2 −2 go-beyond.tex
  4. +9 −8 tab/conversion.tex
@@ -25,16 +25,19 @@
\lstinputlisting[caption=Push/Pop test]{ex-packages/src/pushpop_test.go}
For \prog{go test} to work we need to put our package files in a directory
-under \var{\$GOPATH/src} (see page \pageref{"sec:settings used"}).
+under \var{\$GOPATH/src}:\\
\begin{display}
\pr \user{mkdir $GOPATH/src/stack}
\pr \user{cp pushpop_test.go $GOPATH/src/stack}
\pr \user{cp stack-as-package.go $GOPATH/src/stack}
\end{display}
+Yields:\\
+
\begin{display}
\pr \user{go test stack}
ok stack 0.001s
\end{display}
+
\end{Answer}
View
@@ -88,7 +88,7 @@ \section{Compiling and running code}
\ \newline
\section{Settings used in this book}
-\label{sec:settings used}
+\label{sec:settings_used}
\begin{itemize}
\item Go itself is installed in \file{\~{}/go} ;
\item Go source code we want to compile ourself is placed in \file{\~{}/g/src} and
View
@@ -354,7 +354,7 @@ \section{Conversions}
\begin{itemize}
\item{
-From a \lstinline{string} to a slice of bytes or rune.
+From a \lstinline{string} to a slice of bytes or runes.
\begin{lstlisting}
mystring := "hello this is string"
\end{lstlisting}
@@ -367,7 +367,7 @@ \section{Conversions}
are encoded in UTF-8 some characters in the string may end up in 1, 2, 3
or 4 bytes.
\begin{lstlisting}
-intslice := []rune(mystring)
+runeslice := []rune(mystring)
\end{lstlisting}
Converts to an \type{rune} slice, each \type{rune} contains a Unicode code
point. Every character from the string corresponds to one rune.
View
@@ -1,10 +1,11 @@
-\begin{tabular}{lllllll}
-\textbf{From} & \verb|xb []byte|& \verb|xi []int|& \verb|s string| & \verb|f float32| & \verb|i int| \\ \cmidrule(r){1-6}
-\textbf{To} & & & & & \\ \cmidrule(r){1-1}
-\verb|[]byte| & $\texttimes$ & & \verb|[]byte(s)| & & \\
-\verb|[]int| & & $\texttimes$ & \verb|[]int(s)| & & \\
-\verb|string| &\verb|string(xb)| &\verb|string(xi)|& $\texttimes$ & & \\
-\verb|float32| & & & & $\texttimes$ & \verb|float32(i)|\\
-\verb|int| & & & & \verb|int(f)| & $\texttimes$ \\
+\begin{tabular}{llllllll}
+ \textbf{From} & \verb|xb []byte|& \verb|xi []int| & \verb|xr []rune| & \verb|s string| & \verb|f float32| & \verb|i int| \\ \cmidrule(r){1-7}
+ \textbf{To} & & & & & & \\ \cmidrule(r){1-1}
+ \verb|[]byte| & $\texttimes$ & & & \verb|[]byte(s)| & & \\
+ \verb|[]int| & & $\texttimes$ & & \verb|[]int(s)| & & \\
+ \verb|[]rune| & & & $\texttimes$ & \verb|[]rune(s)| & & \\
+ \verb|string| &\verb|string(xb)| &\verb|string(xi)| & \verb|string(xr)| & $\texttimes$ & & \\
+ \verb|float32| & & & & & $\texttimes$ & \verb|float32(i)|\\
+ \verb|int| & & & & & \verb|int(f)| & $\texttimes$ \\
%%\bottomrule
\end{tabular}

0 comments on commit 1acf43c

Please sign in to comment.