Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go: Руны 22/34 : Поправки к решению #124

Closed
monkrus opened this issue Nov 3, 2022 · 3 comments
Closed

Go: Руны 22/34 : Поправки к решению #124

monkrus opened this issue Nov 3, 2022 · 3 comments
Assignees

Comments

@monkrus
Copy link

monkrus commented Nov 3, 2022

Возможный вариант решения кажется более идиоматичным, избегает ненужной конверсии рун.

package solution

import (
	"unicode"
)

func isASCII(s string) bool {
	for i := 0; i < len(s); i++ {
		if s[i] > unicode.MaxASCII {
			return false
		}
	}
	return true
}
@ashikov
Copy link
Contributor

ashikov commented Nov 7, 2022

@forPelevin глянь, пожалуйста

@forPelevin
Copy link
Contributor

Привет!
Я согласен, что это решение быстрее, чем существующее. Единственный вопрос: мы уверены, что не существует такого unicode символа, который будет состоять из нескольких байт < 127?

@monkrus
Copy link
Author

monkrus commented Nov 10, 2022

Да, тогда первоначальное решение остаётся, пожалуй, оптимальным.

@ashikov ashikov closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants