| 1 |
// compile |
| 2 |
|
| 3 |
// Copyright 2018 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
package main |
| 8 |
|
| 9 |
func ascii(r rune) rune { |
| 10 |
switch { |
| 11 |
case 97 <= r && r <= 122: |
| 12 |
return r - 32 |
| 13 |
case 65 <= r && r <= 90: |
| 14 |
return r + 32 |
| 15 |
default: |
| 16 |
return r |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
func main() { |
| 21 |
nomeObjeto := "ABE1FK21" |
| 22 |
println(string(nomeObjeto[1:4])) |
| 23 |
println(ascii(rune(nomeObjeto[4])) >= 48 && ascii(rune(nomeObjeto[4])) <= 57) |
| 24 |
println(string(nomeObjeto[5])) |
| 25 |
println(string(nomeObjeto[6:10])) |
| 26 |
} |