Skip to content

Commit

Permalink
Update comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
mithrandie committed Jul 23, 2021
1 parent abec0b6 commit fe04283
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions string.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"unicode"
)

// Calculates string width to be displayed.
// Width calculates string width to be displayed.
func Width(s string, eastAsianEncoding bool, countDiacriticalSign bool, countFormatCode bool) int {
l := 0

Expand All @@ -23,7 +23,7 @@ func Width(s string, eastAsianEncoding bool, countDiacriticalSign bool, countFor
return l
}

// Calculates character width to be displayed.
// RuneWidth calculates character width to be displayed.
func RuneWidth(r rune, eastAsianEncoding bool, countDiacriticalSign bool, countFormatCode bool) int {
switch {
case unicode.IsControl(r):
Expand All @@ -40,7 +40,7 @@ func RuneWidth(r rune, eastAsianEncoding bool, countDiacriticalSign bool, countF
return 1
}

// Calculates byte size of a character.
// RuneByteSize calculates byte size of a character.
func RuneByteSize(r rune, encoding Encoding) int {
if encoding == SJIS {
return sjisRuneByteSize(r)
Expand Down Expand Up @@ -68,7 +68,7 @@ func utf16RuneByteSize(r rune) int {
return 2
}

// Calculates byte size of a string.
// ByteSize calculates byte size of a string.
func ByteSize(s string, encoding Encoding) int {
size := 0
for _, c := range s {
Expand All @@ -77,7 +77,7 @@ func ByteSize(s string, encoding Encoding) int {
return size
}

// Returns if a string is Right-to-Left horizontal writing characters.
// IsRightToLeftLetters returns true if a string is Right-to-Left horizontal writing characters.
func IsRightToLeftLetters(s string) bool {
inEscSeq := false // Ignore ANSI Escape Sequence
for _, r := range s {
Expand Down
8 changes: 4 additions & 4 deletions transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func IsLowSurrogate(r rune) bool {
var ErrUnknownEncoding = errors.New("cannot detect character encoding")
var ErrInvalidEncoding = errors.New("invalid character encoding")

// Detects character encoding
// DetectEncoding Detects character encoding
func DetectEncoding(r io.ReadSeeker) (detected Encoding, err error) {
return DetectInSpecifiedEncoding(r, AUTO)
}
Expand Down Expand Up @@ -264,7 +264,7 @@ InferredAsUTF16:
return UTF16BE, nil
}

// Get a reader to transform character encoding from UTF-8 to another encoding.
// GetTransformEncoder gets a reader to transform character encoding from UTF-8 to another encoding.
func GetTransformEncoder(r io.Reader, enc Encoding) (io.Reader, error) {
switch enc {
case UTF8:
Expand All @@ -288,7 +288,7 @@ func GetTransformEncoder(r io.Reader, enc Encoding) (io.Reader, error) {
}
}

// Get a reader to transform character encoding from any encoding to UTF-8.
// GetTransformDecoder gets a reader to transform character encoding from any encoding to UTF-8.
func GetTransformDecoder(r io.Reader, enc Encoding) (io.Reader, error) {
switch enc {
case UTF8:
Expand All @@ -312,7 +312,7 @@ func GetTransformDecoder(r io.Reader, enc Encoding) (io.Reader, error) {
}
}

// Get a writer to transform character encoding from UTF-8 to another encoding.
// GetTransformWriter gets a writer to transform character encoding from UTF-8 to another encoding.
func GetTransformWriter(w io.Writer, enc Encoding) (io.Writer, error) {
switch enc {
case UTF8:
Expand Down

0 comments on commit fe04283

Please sign in to comment.