2009-08-26 17:53:07 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package unicode
|
|
|
|
|
|
|
|
// IsDigit reports whether the rune is a decimal digit.
|
|
|
|
func IsDigit(rune int) bool {
|
2009-12-15 16:41:46 -07:00
|
|
|
if rune < 0x100 { // quick ASCII (Latin-1, really) check
|
2009-11-09 13:07:39 -07:00
|
|
|
return '0' <= rune && rune <= '9'
|
2009-08-26 17:53:07 -06:00
|
|
|
}
|
2009-12-15 16:41:46 -07:00
|
|
|
return Is(Digit, rune)
|
2009-08-26 17:53:07 -06:00
|
|
|
}
|