Guest User

Untitled

a guest
Jul 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. str[i]
  2.  
  3. []rune
  4.  
  5. package main
  6.  
  7. import(
  8. "fmt"
  9. )
  10.  
  11. func subStr(str string, beg int, end int)string {
  12.  
  13. var res string
  14. for i := beg-1; i < end+1; i++ {
  15.  
  16. res = string(res + string(str[i]))
  17. }
  18.  
  19. return res
  20. }
  21.  
  22. func main() {
  23.  
  24. fmt.Println("Testing functionn")
  25.  
  26. str := "añadir algo con letras extrañas aquí"
  27.  
  28. fmt.Println(str)
  29.  
  30. substr := subStr(str, 1, 4)
  31.  
  32. fmt.Println(substr)
  33.  
  34. }
  35.  
  36. Testing function
  37.  
  38. añadir algo con letras extrañas aquí
  39. añad
Add Comment
Please, Sign In to add comment