Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "strings"
- )
- func trim(text string) string {
- length := len(text)
- if length <= 2 {
- return text
- }
- return text[1 : length-1]
- }
- func countVowel (text string) int {
- counter := 0
- text = strings.ToUpper(text)
- for index := range text {
- char := text[index]
- if ( char == 65 || char == 69 || char == 73 || char == 79 || char == 85 ) {
- counter += 1
- }
- }
- return counter
- }
- func main() {
- // #1 https://dev.to/thepracticaldev/daily-challenge-1-string-peeler-4nep
- fmt.Println( trim("testing") )
- fmt.Println( trim("OH") )
- // #3 https://dev.to/thepracticaldev/daily-challenge-3-vowel-counter-34ni
- fmt.Println(countVowel("aseiou"))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement